diff --git a/mautrix_telegram/portal.py b/mautrix_telegram/portal.py index 50be9ccc..40ecc63d 100644 --- a/mautrix_telegram/portal.py +++ b/mautrix_telegram/portal.py @@ -444,6 +444,10 @@ class Portal(DBPortal, BasePortal): def is_direct(self) -> bool: return self.peer_type == "user" + @property + def is_channel(self) -> bool: + return self.peer_type == "channel" + @property def has_bot(self) -> bool: return bool(self.bot) and ( @@ -2809,7 +2813,7 @@ class Portal(DBPortal, BasePortal): intent = sender.intent_for(self) if sender else self.main_intent is_bot = sender.is_bot if sender else False converted = await self._msg_conv.convert( - source, intent, is_bot, evt, no_reply_fallback=True + source, intent, is_bot, self.is_channel, evt, no_reply_fallback=True ) converted.content.set_edit(editing_msg.mxid) await intent.set_typing(self.mxid, timeout=0) @@ -3025,6 +3029,7 @@ class Portal(DBPortal, BasePortal): source, intent, is_bot, + self.is_channel, msg, client=client, deterministic_reply_id=self.bridge.homeserver_software.is_hungry, @@ -3529,7 +3534,7 @@ class Portal(DBPortal, BasePortal): else: intent = self.main_intent is_bot = sender.is_bot if sender else False - converted = await self._msg_conv.convert(source, intent, is_bot, evt) + converted = await self._msg_conv.convert(source, intent, is_bot, self.is_channel, evt) if not converted: return await intent.set_typing(self.mxid, timeout=0) diff --git a/mautrix_telegram/portal_util/message_convert.py b/mautrix_telegram/portal_util/message_convert.py index 6d64aaab..8b3218f7 100644 --- a/mautrix_telegram/portal_util/message_convert.py +++ b/mautrix_telegram/portal_util/message_convert.py @@ -161,6 +161,7 @@ class TelegramMessageConverter: source: au.AbstractUser, intent: IntentAPI, is_bot: bool, + is_channel: bool, evt: Message, no_reply_fallback: bool = False, deterministic_reply_id: bool = False,