Skip to content

Commit 261d7bc

Browse files
authored
feat(Chat): Enhance full_name property with Chat.title fallback. (#206)
1 parent 4836dc6 commit 261d7bc

File tree

1 file changed

+7
-6
lines changed
  • pyrogram/types/user_and_chats

1 file changed

+7
-6
lines changed

pyrogram/types/user_and_chats/chat.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Chat(Object):
4343
4444
username (``str``, *optional*):
4545
Username, for private chats, bots, supergroups and channels if available.
46-
46+
4747
first_name (``str``, *optional*):
4848
First name of the other party in a private chat, for private chats and bots.
4949
@@ -109,7 +109,7 @@ class Chat(Object):
109109
bio (``str``, *optional*):
110110
Bio of the other party in a private chat.
111111
Returned only in :meth:`~pyrogram.Client.get_chat`.
112-
112+
113113
join_by_request (``bool``, *optional*):
114114
True, if all users directly joining the supergroup need to be approved by supergroup administrators.
115115
@@ -222,7 +222,7 @@ class Chat(Object):
222222
send_as_chat (:obj:`~pyrogram.types.Chat`, *optional*):
223223
The default "send_as" chat.
224224
Returned only in :meth:`~pyrogram.Client.get_chat`.
225-
225+
226226
is_peak_preview (``bool``, *optional*):
227227
True, if this is a peak preview.
228228
@@ -231,7 +231,7 @@ class Chat(Object):
231231
232232
pending_join_request_count (``int``, *optional*):
233233
Number of pending join requests in the current chat.
234-
234+
235235
can_enable_paid_reaction (``bool``, *optional*):
236236
True, if paid reaction can be enabled in the channel chat; for channels only.
237237
@@ -250,6 +250,7 @@ class Chat(Object):
250250
251251
full_name (``str``, *property*):
252252
Full name of the other party in a private chat, for private chats and bots.
253+
OR, Title of the chat, for groups and channels.
253254
254255
"""
255256

@@ -645,7 +646,7 @@ async def _parse_full(client, chat_full: Union[raw.types.messages.ChatFull, raw.
645646
parsed_chat.birthdate = types.Birthdate._parse(
646647
full_user.birthday
647648
)
648-
649+
649650
if getattr(full_user, "business_intro", None):
650651
parsed_chat.business_intro = await types.BusinessIntro._parse(
651652
client,
@@ -810,7 +811,7 @@ def full_name(self) -> str:
810811
self.last_name
811812
]
812813
)
813-
) or None
814+
) or self.title or None
814815

815816
async def archive(self):
816817
"""Bound method *archive* of :obj:`~pyrogram.types.Chat`.

0 commit comments

Comments
 (0)