pyrofork: Refactor Message.link

Signed-off-by: wulan17 <wulan17@komodos.id>
This commit is contained in:
wulan17 2025-06-09 19:57:41 +07:00
parent 969a2c0f55
commit 7c94fc8009
No known key found for this signature in database
GPG key ID: 737814D4B5FF0420

View file

@ -1314,8 +1314,13 @@ class Message(Object, Update):
self.chat.type in (enums.ChatType.GROUP, enums.ChatType.SUPERGROUP, enums.ChatType.CHANNEL) self.chat.type in (enums.ChatType.GROUP, enums.ChatType.SUPERGROUP, enums.ChatType.CHANNEL)
and self.chat.username and self.chat.username
): ):
if self.chat.type == enums.ChatType.SUPERGROUP and self.message_thread_id:
return f"https://t.me/{self.chat.username}/{self.message_thread_id}/{self.id}"
return f"https://t.me/{self.chat.username}/{self.id}" return f"https://t.me/{self.chat.username}/{self.id}"
else: if self.chat.type == enums.ChatType.PRIVATE:
return f"tg://openmessage?user_id={self.from_user.id}&message_id={self.id}"
if self.message_thread_id:
return f"https://t.me/c/{utils.get_channel_id(self.chat.id)}/{self.message_thread_id}/{self.id}"
return f"https://t.me/c/{utils.get_channel_id(self.chat.id)}/{self.id}" return f"https://t.me/c/{utils.get_channel_id(self.chat.id)}/{self.id}"
@property @property