Skip to content

Commit 31fa1e4

Browse files
Add some missing fields to Chat and User
1 parent 6e51046 commit 31fa1e4

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

pyrogram/types/user_and_chats/chat.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ class Chat(Object):
3838
is_forum (``bool``, *optional*):
3939
True, if the supergroup chat is a forum.
4040
41+
is_direct_messages_group (``bool``, *optional*):
42+
True, if the supergroup is a direct message group for a channel chat.
43+
44+
is_min (``bool``, *optional*):
45+
True, if this chat have reduced set of fields.
46+
4147
is_verified (``bool``, *optional*):
4248
True, if this chat has been verified by Telegram. Supergroups, channels and bots only.
4349
@@ -128,6 +134,12 @@ class Chat(Object):
128134
Description, for groups, supergroups and channel chats.
129135
Returned only in :meth:`~pyrogram.Client.get_chat`.
130136
137+
show_message_sender_name (``bool``, *optional*):
138+
True, if the chat has a username.
139+
140+
sign_messages (``bool``, *optional*):
141+
True, if messages sent to the channel contains name of the sender. This field is only applicable to channels.
142+
131143
dc_id (``int``, *optional*):
132144
The chat assigned DC (data center). Available only in case the chat has a photo.
133145
Note that this information is approximate; it is based on where Telegram stores the current chat photo.
@@ -472,6 +484,8 @@ def __init__(
472484
id: Optional[int] = None,
473485
type: Optional["enums.ChatType"] = None,
474486
is_forum: Optional[bool] = None,
487+
is_direct_messages_group: Optional[bool] = None,
488+
is_min: Optional[bool] = None,
475489
is_verified: Optional[bool] = None,
476490
is_members_hidden: Optional[bool] = None,
477491
is_restricted: Optional[bool] = None,
@@ -501,6 +515,8 @@ def __init__(
501515
chat_background: Optional["types.ChatBackground"] = None,
502516
bio: Optional[str] = None,
503517
description: Optional[str] = None,
518+
show_message_sender_name: Optional[bool] = None,
519+
sign_messages: Optional[bool] = None,
504520
dc_id: Optional[int] = None,
505521
folder_id: Optional[int] = None,
506522
has_protected_content: Optional[bool] = None,
@@ -597,6 +613,8 @@ def __init__(
597613
self.id = id
598614
self.type = type
599615
self.is_forum = is_forum
616+
self.is_direct_messages_group = is_direct_messages_group
617+
self.is_min = is_min
600618
self.is_verified = is_verified
601619
self.is_members_hidden = is_members_hidden
602620
self.is_restricted = is_restricted
@@ -626,6 +644,8 @@ def __init__(
626644
self.chat_background = chat_background
627645
self.bio = bio
628646
self.description = description
647+
self.show_message_sender_name = show_message_sender_name
648+
self.sign_messages = sign_messages
629649
self.dc_id = dc_id
630650
self.folder_id = folder_id
631651
self.has_protected_content = has_protected_content
@@ -819,6 +839,8 @@ def _parse_channel_chat(client, channel: "raw.types.Channel") -> Optional["Chat"
819839
id=peer_id,
820840
type=chat_type,
821841
is_forum=channel.forum,
842+
is_direct_messages_group=channel.monoforum,
843+
is_min=channel.min,
822844
is_verified=channel.verified,
823845
is_restricted=channel.restricted,
824846
is_creator=channel.creator,
@@ -834,6 +856,8 @@ def _parse_channel_chat(client, channel: "raw.types.Channel") -> Optional["Chat"
834856
usernames=types.List([types.Username._parse(r) for r in usernames]) or None,
835857
photo=types.ChatPhoto._parse(client, channel.photo, peer_id,
836858
getattr(channel, "access_hash", 0)),
859+
show_message_sender_name=channel.signature_profiles,
860+
sign_messages=channel.signatures,
837861
restrictions=types.List([types.Restriction._parse(r) for r in restriction_reason]) or None,
838862
permissions=types.ChatPermissions._parse(channel.default_banned_rights),
839863
members_count=channel.participants_count,

pyrogram/types/user_and_chats/user.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ class User(Object, Update):
115115
is_business_bot (``bool``, *optional*):
116116
True, if this bot can connect to business account.
117117
118+
is_min (``bool``, *optional*):
119+
True, if this user have reduced set of fields.
120+
118121
first_name (``str``, *optional*):
119122
User's or bot's first name.
120123
@@ -228,6 +231,7 @@ def __init__(
228231
is_stories_hidden: bool = None,
229232
is_stories_unavailable: bool = None,
230233
is_business_bot: bool = None,
234+
is_min: bool = None,
231235
first_name: str = None,
232236
last_name: str = None,
233237
status: "enums.UserStatus" = None,
@@ -274,6 +278,7 @@ def __init__(
274278
self.is_stories_hidden = is_stories_hidden
275279
self.is_stories_unavailable = is_stories_unavailable
276280
self.is_business_bot = is_business_bot
281+
self.is_min = is_min
277282
self.first_name = first_name
278283
self.last_name = last_name
279284
self.status = status
@@ -336,6 +341,7 @@ def _parse(client, user: "raw.base.User") -> Optional["User"]:
336341
is_stories_hidden=user.stories_hidden,
337342
is_stories_unavailable=user.stories_unavailable,
338343
is_business_bot=user.bot_business,
344+
is_min=user.min,
339345
first_name=user.first_name,
340346
last_name=user.last_name,
341347
**User._parse_status(user.status, user.bot),

0 commit comments

Comments
 (0)