diff --git a/tgram/bound.py b/tgram/bound.py index 2a85d49..7c918f6 100644 --- a/tgram/bound.py +++ b/tgram/bound.py @@ -516,6 +516,21 @@ def media( return None + @property + def link(self: "tgram.types.Message") -> Optional[str]: + return ( + ( + "https://t.me/c/{chat_id}/{msg_id}" + if not self.chat.username + else "https://t.me/{chat_id}/{msg_id}" + ).format( + chat_id=self.chat.username or str(self.chat.id).replace("-100", ""), + msg_id=self.id, + ) + if self.chat.type != "private" + else None + ) + @property def __reply_param(self) -> "tgram.types.ReplyParameters": return tgram.types.ReplyParameters(self.id)