Document undocumented properties

This commit is contained in:
Dan 2020-08-26 08:10:34 +02:00
parent 15f504a91f
commit c5dd474f93
3 changed files with 8 additions and 4 deletions

View File

@ -416,7 +416,8 @@ def pyrogram_api():
title = "{}".format(type)
f2.write(title + "\n" + "=" * len(title) + "\n\n")
f2.write(".. autoclass:: pyrogram.types.{}()".format(type))
f2.write(".. autoclass:: pyrogram.types.{}()\n".format(type))
f2.write(" :members:\n")
f.write(template.format(**fmt_keys))

View File

@ -245,9 +245,6 @@ 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 <https://docs.python.org/3/library/re.html#match-objects>`_ that match
the text of this message. Only applicable when using :obj:`Filters.regex <pyrogram.Filters.regex>`.
@ -675,6 +672,7 @@ class Message(Object, Update):
@property
def link(self) -> str:
"""Generate a link to this message, only for groups and channels."""
if self.chat.type in ("group", "supergroup", "channel") and self.chat.username:
return f"https://t.me/{self.chat.username}/{self.message_id}"
else:

View File

@ -192,6 +192,11 @@ class User(Object, Update):
@property
def mention(self):
"""Generate a text mention for this user.
You can use ``user.mention()`` to mention the user using their first name (styled using html), or
``user.mention("another name")`` for a custom name. To choose a different style
("html" or "md"/"markdown") use ``user.mention(style="md")``."""
return Link(f"tg://user?id={self.id}", self.first_name, self._client.parse_mode)
@staticmethod