Skip to content

Commit

Permalink
Pass through is channel to msg conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Mar 25, 2024
1 parent dbfbf12 commit 2b5fc18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mautrix_telegram/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ def peer(self) -> TypePeer | TypeInputPeer:
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 (
Expand Down Expand Up @@ -2809,7 +2813,7 @@ async def handle_telegram_edit(
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)
Expand Down Expand Up @@ -3025,6 +3029,7 @@ async def _convert_batch_msg(
source,
intent,
is_bot,
self.is_channel,
msg,
client=client,
deterministic_reply_id=self.bridge.homeserver_software.is_hungry,
Expand Down Expand Up @@ -3529,7 +3534,7 @@ async def _handle_telegram_message(
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)
Expand Down
1 change: 1 addition & 0 deletions mautrix_telegram/portal_util/message_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ async def convert(
source: au.AbstractUser,
intent: IntentAPI,
is_bot: bool,
is_channel: bool,
evt: Message,
no_reply_fallback: bool = False,
deterministic_reply_id: bool = False,
Expand Down

0 comments on commit 2b5fc18

Please sign in to comment.