From 4edf0cdaa53bc197699a41a5566ae3d6e9fbc9cd Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Thu, 1 Apr 2021 02:24:27 -0400 Subject: [PATCH] Set room avatar on room creation Also set proper power levels --- matrix_puppeteer_line/portal.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/matrix_puppeteer_line/portal.py b/matrix_puppeteer_line/portal.py index bef069b..567ce64 100644 --- a/matrix_puppeteer_line/portal.py +++ b/matrix_puppeteer_line/portal.py @@ -454,20 +454,22 @@ class Portal(DBPortal, BasePortal): "type": "m.room.related_groups", "content": {"groups": [self.config["appservice.community_id"]]}, }) - #initial_state.append({ - # "type": str(EventType.ROOM_POWER_LEVELS), - # "content": { - # "users": { - # self.az.bot_mxid: 100, - # self.main_intent.mxid: 100, - # }, - # "events": {}, - # "events_default": 100, - # "state_default": 50, - # "invite": 50, - # "redact": 0 - # } - #}) + initial_state.append({ + "type": str(EventType.ROOM_POWER_LEVELS), + "content": { + "users": { + self.az.bot_mxid: 100, + self.main_intent.mxid: 100, + } + } + }) + if self.icon_mxc: + initial_state.append({ + "type": str(EventType.ROOM_AVATAR), + "content": { + "url": self.icon_mxc + } + }) # We lock backfill lock here so any messages that come between the room being created # and the initial backfill finishing wouldn't be bridged before the backfill messages.