Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pyrogram/types/user_and_chats/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,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__(
Expand Down Expand Up @@ -195,6 +198,10 @@ def __init__(
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
Expand Down
7 changes: 7 additions & 0 deletions pyrogram/types/user_and_chats/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -203,6 +206,10 @@ def __init__(
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(
Expand Down