Pyrofork: Add slow_mode_delay in get_chat (#43)

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
Yasir Aris M 2024-01-22 06:54:58 +07:00 committed by wulan17
parent 4c11bcdc7f
commit 48f313b412
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5

View file

@ -134,6 +134,10 @@ class Chat(Object):
Chat members count, for groups, supergroups and channels only. Chat members count, for groups, supergroups and channels only.
Returned only in :meth:`~pyrogram.Client.get_chat`. Returned only in :meth:`~pyrogram.Client.get_chat`.
slow_mode_delay (``int``, *optional*):
For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user in seconds.
Returned only in :meth:`~pyrogram.Client.get_chat`.
restrictions (List of :obj:`~pyrogram.types.Restriction`, *optional*): restrictions (List of :obj:`~pyrogram.types.Restriction`, *optional*):
The list of reasons why this chat might be unavailable to some users. The list of reasons why this chat might be unavailable to some users.
This field is available only in case *is_restricted* is True. This field is available only in case *is_restricted* is True.
@ -209,6 +213,7 @@ class Chat(Object):
sticker_set_name: str = None, sticker_set_name: str = None,
can_set_sticker_set: bool = None, can_set_sticker_set: bool = None,
members_count: int = None, members_count: int = None,
slow_mode_delay: int = None,
restrictions: List["types.Restriction"] = None, restrictions: List["types.Restriction"] = None,
permissions: "types.ChatPermissions" = None, permissions: "types.ChatPermissions" = None,
distance: int = None, distance: int = None,
@ -251,6 +256,7 @@ class Chat(Object):
self.sticker_set_name = sticker_set_name self.sticker_set_name = sticker_set_name
self.can_set_sticker_set = can_set_sticker_set self.can_set_sticker_set = can_set_sticker_set
self.members_count = members_count self.members_count = members_count
self.slow_mode_delay = slow_mode_delay
self.restrictions = restrictions self.restrictions = restrictions
self.permissions = permissions self.permissions = permissions
self.distance = distance self.distance = distance
@ -428,6 +434,7 @@ class Chat(Object):
else: else:
parsed_chat = Chat._parse_channel_chat(client, chat_raw) parsed_chat = Chat._parse_channel_chat(client, chat_raw)
parsed_chat.members_count = full_chat.participants_count parsed_chat.members_count = full_chat.participants_count
parsed_chat.slow_mode_delay = getattr(full_chat, "slowmode_seconds", None)
parsed_chat.description = full_chat.about or None parsed_chat.description = full_chat.about or None
# TODO: Add StickerSet type # TODO: Add StickerSet type
parsed_chat.can_set_sticker_set = full_chat.can_set_stickers parsed_chat.can_set_sticker_set = full_chat.can_set_stickers