Pass through is channel to msg conversion
This commit is contained in:
committed by
Nick Mills-Barrett
parent
dbfbf12862
commit
ab6a6654f7
@@ -444,6 +444,10 @@ class Portal(DBPortal, BasePortal):
|
|||||||
def is_direct(self) -> bool:
|
def is_direct(self) -> bool:
|
||||||
return self.peer_type == "user"
|
return self.peer_type == "user"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_channel(self) -> bool:
|
||||||
|
return self.peer_type == "channel"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_bot(self) -> bool:
|
def has_bot(self) -> bool:
|
||||||
return bool(self.bot) and (
|
return bool(self.bot) and (
|
||||||
@@ -2809,7 +2813,7 @@ class Portal(DBPortal, BasePortal):
|
|||||||
intent = sender.intent_for(self) if sender else self.main_intent
|
intent = sender.intent_for(self) if sender else self.main_intent
|
||||||
is_bot = sender.is_bot if sender else False
|
is_bot = sender.is_bot if sender else False
|
||||||
converted = await self._msg_conv.convert(
|
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)
|
converted.content.set_edit(editing_msg.mxid)
|
||||||
await intent.set_typing(self.mxid, timeout=0)
|
await intent.set_typing(self.mxid, timeout=0)
|
||||||
@@ -3025,6 +3029,7 @@ class Portal(DBPortal, BasePortal):
|
|||||||
source,
|
source,
|
||||||
intent,
|
intent,
|
||||||
is_bot,
|
is_bot,
|
||||||
|
self.is_channel,
|
||||||
msg,
|
msg,
|
||||||
client=client,
|
client=client,
|
||||||
deterministic_reply_id=self.bridge.homeserver_software.is_hungry,
|
deterministic_reply_id=self.bridge.homeserver_software.is_hungry,
|
||||||
@@ -3529,7 +3534,7 @@ class Portal(DBPortal, BasePortal):
|
|||||||
else:
|
else:
|
||||||
intent = self.main_intent
|
intent = self.main_intent
|
||||||
is_bot = sender.is_bot if sender else False
|
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:
|
if not converted:
|
||||||
return
|
return
|
||||||
await intent.set_typing(self.mxid, timeout=0)
|
await intent.set_typing(self.mxid, timeout=0)
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ class TelegramMessageConverter:
|
|||||||
source: au.AbstractUser,
|
source: au.AbstractUser,
|
||||||
intent: IntentAPI,
|
intent: IntentAPI,
|
||||||
is_bot: bool,
|
is_bot: bool,
|
||||||
|
is_channel: bool,
|
||||||
evt: Message,
|
evt: Message,
|
||||||
no_reply_fallback: bool = False,
|
no_reply_fallback: bool = False,
|
||||||
deterministic_reply_id: bool = False,
|
deterministic_reply_id: bool = False,
|
||||||
|
|||||||
Reference in New Issue
Block a user