diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py index 47606715..f2f6abab 100644 --- a/pyrogram/client/types/messages_and_media/message.py +++ b/pyrogram/client/types/messages_and_media/message.py @@ -251,6 +251,9 @@ class Message(Object, Update): Messages sent from yourself to other chats are outgoing (*outgoing* is True). An exception is made for your own personal chat; messages sent there will be incoming. + link (``str``): + A link to the message, only for groups and channels. + matches (List of regex Matches, *optional*): A list containing all `Match Objects `_ that match the text of this message. Only applicable when using :obj:`Filters.regex `. @@ -670,6 +673,13 @@ class Message(Object, Update): return parsed_message + @property + def link(self) -> str: + if self.chat.type in ("group", "supergroup", "channel") and self.chat.username: + return "https://t.me/{}/{}".format(self.chat.username, self.message_id) + else: + return "https://t.me/c/{}/{}".format(utils.get_channel_id(self.chat.id), self.message_id) + def reply_text( self, text: str,