mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Add full_name property to User and Chat objects
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
2afbe7f4fd
commit
4401c62244
2 changed files with 14 additions and 0 deletions
|
|
@ -132,6 +132,9 @@ class Chat(Object):
|
|||
available_reactions (:obj:`~pyrogram.types.ChatReactions`, *optional*):
|
||||
Available reactions in the chat.
|
||||
Returned only in :meth:`~pyrogram.Client.get_chat`.
|
||||
|
||||
full_name (``str``, *property*):
|
||||
Full name of the other party in a private chat, for private chats and bots.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
|
@ -200,6 +203,10 @@ class Chat(Object):
|
|||
self.send_as_chat = send_as_chat
|
||||
self.available_reactions = available_reactions
|
||||
|
||||
@property
|
||||
def full_name(self) -> str:
|
||||
return " ".join(filter(None, [self.first_name, self.last_name])) or None
|
||||
|
||||
@staticmethod
|
||||
def _parse_user_chat(client, user: raw.types.User) -> "Chat":
|
||||
peer_id = user.id
|
||||
|
|
|
|||
|
|
@ -140,6 +140,9 @@ class User(Object, Update):
|
|||
The list of reasons why this bot might be unavailable to some users.
|
||||
This field is available only in case *is_restricted* is True.
|
||||
|
||||
full_name (``str``, *optional*):
|
||||
User's or bot's full name.
|
||||
|
||||
mention (``str``, *property*):
|
||||
Generate a text mention for this user.
|
||||
You can use ``user.mention()`` to mention the user using their first name (styled using html), or
|
||||
|
|
@ -203,6 +206,10 @@ class User(Object, Update):
|
|||
self.photo = photo
|
||||
self.restrictions = restrictions
|
||||
|
||||
@property
|
||||
def full_name(self) -> str:
|
||||
return " ".join(filter(None, [self.first_name, self.last_name])) or None
|
||||
|
||||
@property
|
||||
def mention(self):
|
||||
return Link(
|
||||
|
|
|
|||
Loading…
Reference in a new issue