Skip to content

Commit

Permalink
Add message.link
Browse files Browse the repository at this point in the history
  • Loading branch information
z44d committed Jul 7, 2024
1 parent d8440d3 commit 18d549a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tgram/bound.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 18d549a

Please sign in to comment.