mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: Refactor Message.link
Signed-off-by: wulan17 <wulan17@komodos.id>
This commit is contained in:
parent
8880a92483
commit
83f3f52681
1 changed files with 7 additions and 2 deletions
|
|
@ -1314,9 +1314,14 @@ 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"https://t.me/c/{utils.get_channel_id(self.chat.id)}/{self.id}"
|
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}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def content(self) -> str:
|
def content(self) -> str:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue