mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-30 13:57:54 +00:00
Add support for can_manage_chat permission
This commit is contained in:
@@ -28,12 +28,13 @@ class PromoteChatMember(Scaffold):
|
|||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
user_id: Union[int, str],
|
user_id: Union[int, str],
|
||||||
is_anonymous: bool = False,
|
is_anonymous: bool = False,
|
||||||
can_change_info: bool = True,
|
can_manage_chat: bool = True,
|
||||||
|
can_change_info: bool = False,
|
||||||
can_post_messages: bool = False,
|
can_post_messages: bool = False,
|
||||||
can_edit_messages: bool = False,
|
can_edit_messages: bool = False,
|
||||||
can_delete_messages: bool = True,
|
can_delete_messages: bool = False,
|
||||||
can_restrict_members: bool = True,
|
can_restrict_members: bool = False,
|
||||||
can_invite_users: bool = True,
|
can_invite_users: bool = False,
|
||||||
can_pin_messages: bool = False,
|
can_pin_messages: bool = False,
|
||||||
can_promote_members: bool = False,
|
can_promote_members: bool = False,
|
||||||
can_manage_voice_chats: bool = False
|
can_manage_voice_chats: bool = False
|
||||||
@@ -54,6 +55,11 @@ class PromoteChatMember(Scaffold):
|
|||||||
is_anonymous (``bool``, *optional*):
|
is_anonymous (``bool``, *optional*):
|
||||||
Pass True, if the administrator's presence in the chat is hidden.
|
Pass True, if the administrator's presence in the chat is hidden.
|
||||||
|
|
||||||
|
can_manage_chat (``bool``, *optional*):
|
||||||
|
Pass True, if the administrator can access the chat event log, chat statistics, message statistics
|
||||||
|
in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode.
|
||||||
|
Implied by any other administrator privilege.
|
||||||
|
|
||||||
can_change_info (``bool``, *optional*):
|
can_change_info (``bool``, *optional*):
|
||||||
Pass True, if the administrator can change chat title, photo and other settings.
|
Pass True, if the administrator can change chat title, photo and other settings.
|
||||||
|
|
||||||
@@ -106,7 +112,8 @@ class PromoteChatMember(Scaffold):
|
|||||||
invite_users=can_invite_users or None,
|
invite_users=can_invite_users or None,
|
||||||
pin_messages=can_pin_messages or None,
|
pin_messages=can_pin_messages or None,
|
||||||
add_admins=can_promote_members or None,
|
add_admins=can_promote_members or None,
|
||||||
manage_call=can_manage_voice_chats or None
|
manage_call=can_manage_voice_chats or None,
|
||||||
|
other=can_manage_chat or None
|
||||||
),
|
),
|
||||||
rank=""
|
rank=""
|
||||||
)
|
)
|
||||||
|
@@ -66,6 +66,12 @@ class ChatMember(Object):
|
|||||||
Administrators only.
|
Administrators only.
|
||||||
True, if you are allowed to edit administrator privileges of the user.
|
True, if you are allowed to edit administrator privileges of the user.
|
||||||
|
|
||||||
|
can_manage_chat (``bool``, *optional*):
|
||||||
|
Administrators only.
|
||||||
|
True, if the administrator can access the chat event log, chat statistics, message statistics in channels,
|
||||||
|
see channel members, see anonymous administrators in supergroups and ignore slow mode.
|
||||||
|
Implied by any other administrator privilege.
|
||||||
|
|
||||||
can_post_messages (``bool``, *optional*):
|
can_post_messages (``bool``, *optional*):
|
||||||
Administrators only. Channels only.
|
Administrators only. Channels only.
|
||||||
True, if the administrator can post messages in the channel.
|
True, if the administrator can post messages in the channel.
|
||||||
@@ -150,6 +156,7 @@ class ChatMember(Object):
|
|||||||
|
|
||||||
# Admin permissions
|
# Admin permissions
|
||||||
can_be_edited: bool = None,
|
can_be_edited: bool = None,
|
||||||
|
can_manage_chat: bool = None,
|
||||||
can_post_messages: bool = None, # Channels only
|
can_post_messages: bool = None, # Channels only
|
||||||
can_edit_messages: bool = None, # Channels only
|
can_edit_messages: bool = None, # Channels only
|
||||||
can_delete_messages: bool = None,
|
can_delete_messages: bool = None,
|
||||||
@@ -184,6 +191,7 @@ class ChatMember(Object):
|
|||||||
self.is_anonymous = is_anonymous
|
self.is_anonymous = is_anonymous
|
||||||
|
|
||||||
self.can_be_edited = can_be_edited
|
self.can_be_edited = can_be_edited
|
||||||
|
self.can_manage_chat = can_manage_chat
|
||||||
self.can_post_messages = can_post_messages
|
self.can_post_messages = can_post_messages
|
||||||
self.can_edit_messages = can_edit_messages
|
self.can_edit_messages = can_edit_messages
|
||||||
self.can_delete_messages = can_delete_messages
|
self.can_delete_messages = can_delete_messages
|
||||||
@@ -248,6 +256,7 @@ class ChatMember(Object):
|
|||||||
title=member.rank,
|
title=member.rank,
|
||||||
invited_by=invited_by,
|
invited_by=invited_by,
|
||||||
can_change_info=permissions.change_info,
|
can_change_info=permissions.change_info,
|
||||||
|
can_manage_chat=permissions.other,
|
||||||
can_post_messages=permissions.post_messages,
|
can_post_messages=permissions.post_messages,
|
||||||
can_edit_messages=permissions.edit_messages,
|
can_edit_messages=permissions.edit_messages,
|
||||||
can_delete_messages=permissions.delete_messages,
|
can_delete_messages=permissions.delete_messages,
|
||||||
@@ -271,6 +280,7 @@ class ChatMember(Object):
|
|||||||
invited_by=invited_by,
|
invited_by=invited_by,
|
||||||
promoted_by=types.User._parse(client, users[member.promoted_by]),
|
promoted_by=types.User._parse(client, users[member.promoted_by]),
|
||||||
can_be_edited=member.can_edit,
|
can_be_edited=member.can_edit,
|
||||||
|
can_manage_chat=permissions.other,
|
||||||
can_change_info=permissions.change_info,
|
can_change_info=permissions.change_info,
|
||||||
can_post_messages=permissions.post_messages,
|
can_post_messages=permissions.post_messages,
|
||||||
can_edit_messages=permissions.edit_messages,
|
can_edit_messages=permissions.edit_messages,
|
||||||
|
Reference in New Issue
Block a user