diff --git a/mautrix_appservice/intent_api.py b/mautrix_appservice/intent_api.py index a0b18056..6b411cec 100644 --- a/mautrix_appservice/intent_api.py +++ b/mautrix_appservice/intent_api.py @@ -198,7 +198,7 @@ class IntentAPI: return self.client.create_room(alias, is_public, name, topic, is_direct, invitees, initial_state or {}) - def invite(self, room_id, user_id, check_cache): + def invite(self, room_id, user_id, check_cache=False): self.ensure_joined(room_id) try: ok_states = {"invite", "join"} diff --git a/mautrix_telegram/commands.py b/mautrix_telegram/commands.py index ea3d3340..5375b443 100644 --- a/mautrix_telegram/commands.py +++ b/mautrix_telegram/commands.py @@ -334,8 +334,12 @@ class CommandHandler: updates = sender.client(JoinChannelRequest(channel)) for chat in updates.chats: portal = po.Portal.get_by_entity(chat) - portal.create_matrix_room(sender, chat, [sender.mxid]) - self.reply(f"Created room for {portal.title}") + if portal.mxid: + portal.create_matrix_room(sender, chat, [sender.mxid]) + self.reply(f"Created room for {portal.title}") + else: + portal.invite_matrix([sender.mxid]) + self.reply(f"Invited you to portal of {portal.title}") @command_handler def create(self, sender, args):