mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 20:14:51 +00:00
Pyrogram: Add can_manage_topics fields to ChatPrivileges and ChatPermissions class
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
115b9877b6
commit
eeb1338c48
2 changed files with 16 additions and 2 deletions
|
|
@ -53,6 +53,10 @@ class ChatPermissions(Object):
|
|||
can_pin_messages (``bool``, *optional*):
|
||||
True, if the user is allowed to pin messages.
|
||||
Ignored in public supergroups.
|
||||
|
||||
can_manage_topics (``bool``, *optional*):
|
||||
True, if the user is allowed to create, rename, close, and reopen forum topics.
|
||||
supergroups only.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
|
@ -65,7 +69,8 @@ class ChatPermissions(Object):
|
|||
can_add_web_page_previews: bool = None,
|
||||
can_change_info: bool = None,
|
||||
can_invite_users: bool = None,
|
||||
can_pin_messages: bool = None
|
||||
can_pin_messages: bool = None,
|
||||
can_manage_topics: bool = None
|
||||
):
|
||||
super().__init__(None)
|
||||
|
||||
|
|
@ -77,6 +82,7 @@ class ChatPermissions(Object):
|
|||
self.can_change_info = can_change_info
|
||||
self.can_invite_users = can_invite_users
|
||||
self.can_pin_messages = can_pin_messages
|
||||
self.can_manage_topics = can_manage_topics
|
||||
|
||||
@staticmethod
|
||||
def _parse(denied_permissions: "raw.base.ChatBannedRights") -> "ChatPermissions":
|
||||
|
|
@ -94,5 +100,6 @@ class ChatPermissions(Object):
|
|||
can_send_polls=not denied_permissions.send_polls,
|
||||
can_change_info=not denied_permissions.change_info,
|
||||
can_invite_users=not denied_permissions.invite_users,
|
||||
can_pin_messages=not denied_permissions.pin_messages
|
||||
can_pin_messages=not denied_permissions.pin_messages,
|
||||
can_manage_topics=not denied_permissions.manage_topics
|
||||
)
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ class ChatPrivileges(Object):
|
|||
Groups and supergroups only.
|
||||
True, if the user is allowed to pin messages.
|
||||
|
||||
can_manage_topics (``bool``, *optional*):
|
||||
supergroups only.
|
||||
True, if the user is allowed to create, rename, close, and reopen forum topics.
|
||||
|
||||
is_anonymous (``bool``, *optional*):
|
||||
True, if the user's presence in the chat is hidden.
|
||||
"""
|
||||
|
|
@ -79,6 +83,7 @@ class ChatPrivileges(Object):
|
|||
can_edit_messages: bool = False, # Channels only
|
||||
can_invite_users: bool = False,
|
||||
can_pin_messages: bool = False, # Groups and supergroups only
|
||||
can_manage_topics: bool = False, # supergroups only.
|
||||
is_anonymous: bool = False
|
||||
):
|
||||
super().__init__(None)
|
||||
|
|
@ -93,6 +98,7 @@ class ChatPrivileges(Object):
|
|||
self.can_edit_messages: bool = can_edit_messages
|
||||
self.can_invite_users: bool = can_invite_users
|
||||
self.can_pin_messages: bool = can_pin_messages
|
||||
self.can_manage_topics: bool = can_manage_topics
|
||||
self.is_anonymous: bool = is_anonymous
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -108,5 +114,6 @@ class ChatPrivileges(Object):
|
|||
can_edit_messages=admin_rights.edit_messages,
|
||||
can_invite_users=admin_rights.invite_users,
|
||||
can_pin_messages=admin_rights.pin_messages,
|
||||
can_manage_topics=admin_rights.manage_topics,
|
||||
is_anonymous=admin_rights.anonymous
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue