mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-21 09:18:23 +02:00
Integrate BigBlueButton and whiteboard in pool rooms
This commit is contained in:
@ -263,6 +263,46 @@ class Matrix:
|
||||
content=content,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@async_to_sync
|
||||
async def add_integration(cls, room_id: str, widget_url: str, state_key: str,
|
||||
widget_type: str = "customwidget", widget_name: str = "Custom widget",
|
||||
widget_title: str = ""):
|
||||
client = await cls._get_client()
|
||||
if room_id.startswith("#"):
|
||||
room_id = await cls.resolve_room_alias(room_id)
|
||||
content = {
|
||||
"type": widget_type,
|
||||
"url": widget_url,
|
||||
"name": widget_name,
|
||||
"data": {
|
||||
"curl": widget_url,
|
||||
"title": widget_title,
|
||||
},
|
||||
"creatorUserId": client.user,
|
||||
"roomId": room_id,
|
||||
"id": state_key,
|
||||
}
|
||||
return await client.room_put_state(
|
||||
room_id=room_id,
|
||||
event_type="im.vector.modular.widgets",
|
||||
content=content,
|
||||
state_key=state_key,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@async_to_sync
|
||||
async def remove_integration(cls, room_id: str, state_key: str):
|
||||
client = await cls._get_client()
|
||||
if room_id.startswith("#"):
|
||||
room_id = await cls.resolve_room_alias(room_id)
|
||||
return await client.room_put_state(
|
||||
room_id=room_id,
|
||||
event_type="im.vector.modular.widgets",
|
||||
content={},
|
||||
state_key=state_key,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@async_to_sync
|
||||
async def kick(cls, room_id: str, user_id: str, reason: str = None):
|
||||
|
Reference in New Issue
Block a user