mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added basic groups to skipped pattern, simplified code
This commit is contained in:
parent
bc03032e97
commit
cb424bacab
1 changed files with 5 additions and 6 deletions
|
|
@ -1723,16 +1723,15 @@ class Message(TelegramObject):
|
||||||
:param force_private: if set, a private URL is returned even for a public chat
|
:param force_private: if set, a private URL is returned even for a public chat
|
||||||
:return: string with full message URL
|
:return: string with full message URL
|
||||||
"""
|
"""
|
||||||
if self.chat.type == "private":
|
if self.chat.type in ("private", "group"):
|
||||||
raise TypeError("Invalid chat type!")
|
raise TypeError("Invalid chat type!")
|
||||||
|
|
||||||
url = "https://t.me/"
|
|
||||||
if not self.chat.username or force_private:
|
if not self.chat.username or force_private:
|
||||||
url += f"c/{self.chat.shifted_id}/"
|
chat_value = f"c/{self.chat.shifted_id}"
|
||||||
else:
|
else:
|
||||||
url += f"{self.chat.username}/"
|
chat_value = f"{self.chat.username}"
|
||||||
url += f"{self.message_id}"
|
|
||||||
return url
|
return f"https://t.me/{chat_value}/{self.message_id}"
|
||||||
|
|
||||||
|
|
||||||
class ContentType(helper.Helper):
|
class ContentType(helper.Helper):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue