From 3ada6d710b960c1151377fa688b575fe136eee05 Mon Sep 17 00:00:00 2001 From: Nick Mills-Barrett Date: Mon, 25 Mar 2024 13:38:53 +0000 Subject: [PATCH] Fix --- mautrix_telegram/portal_util/message_convert.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mautrix_telegram/portal_util/message_convert.py b/mautrix_telegram/portal_util/message_convert.py index f7aa5532..3652c26e 100644 --- a/mautrix_telegram/portal_util/message_convert.py +++ b/mautrix_telegram/portal_util/message_convert.py @@ -237,10 +237,12 @@ def _caption_to_message(converted: ConvertedMessage) -> None: content["format"] = Format.HTML.value def _get_external_url(self, evt: Message) -> str | None: - if self.portal.peer_type == "chat": - return f"https://t.me/c/{self.portal.tgid}/{evt.id}" - if self.portal.username is not None: + if self.portal.peer_type == "channel" and self.portal.username is not None: return f"https://t.me/{self.portal.username}/{evt.id}" + elif self.portal.peer_type != "user": + return f"https://t.me/c/{self.portal.tgid}/{evt.id}" + else: + return f"https://t.me/{self.portal.tgid}/{evt.id}" return None @staticmethod