From 9f520b73402bd0571717d1c760dcfa9ff42c941b Mon Sep 17 00:00:00 2001 From: Kumi Date: Tue, 9 May 2023 11:57:08 +0000 Subject: [PATCH] Set logo on space creation --- commands/space.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/commands/space.py b/commands/space.py index 68d58ee..075eb9a 100644 --- a/commands/space.py +++ b/commands/space.py @@ -20,6 +20,11 @@ async def command_space(room: MatrixRoom, event: RoomMessageText, bot): bot.logger.log( f"Created space {space} for user {event.sender}") + if bot.logo_uri: + await bot.matrix_client.room_put_state(space, "m.room.avatar", { + "url": bot.logo_uri + }, "") + with bot.database.cursor() as cursor: cursor.execute( "INSERT INTO user_spaces (space_id, user_id) VALUES (?, ?)", (space, event.sender)) @@ -87,6 +92,11 @@ async def command_space(room: MatrixRoom, event: RoomMessageText, bot): await bot.add_rooms_to_space(space, join_rooms) + if bot.logo_uri: + await bot.matrix_client.room_put_state(space, "m.room.avatar", { + "url": bot.logo_uri + }, "") + await bot.send_message(room, "Space updated.", True) return