mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Added use_independent_chat_permissions for restrictchatmember
This commit is contained in:
parent
9e68f76f5d
commit
d0d03d0c09
@ -2917,7 +2917,8 @@ class TeleBot:
|
||||
can_add_web_page_previews: Optional[bool]=None,
|
||||
can_change_info: Optional[bool]=None,
|
||||
can_invite_users: Optional[bool]=None,
|
||||
can_pin_messages: Optional[bool]=None) -> bool:
|
||||
can_pin_messages: Optional[bool]=None,
|
||||
use_independent_chat_permissions: Optional[bool]=None) -> bool:
|
||||
"""
|
||||
Use this method to restrict a user in a supergroup.
|
||||
The bot must be an administrator in the supergroup for this to work and must have
|
||||
@ -2965,6 +2966,12 @@ class TeleBot:
|
||||
:param can_pin_messages: Pass True, if the user is allowed to pin messages. Ignored in public supergroups
|
||||
:type can_pin_messages: :obj:`bool`
|
||||
|
||||
:param use_independent_chat_permissions: Pass True if chat permissions are set independently. Otherwise,
|
||||
the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages,
|
||||
can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and
|
||||
can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.
|
||||
:type use_independent_chat_permissions: :obj:`bool`
|
||||
|
||||
:return: True on success
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
@ -2973,7 +2980,7 @@ class TeleBot:
|
||||
can_send_messages, can_send_media_messages,
|
||||
can_send_polls, can_send_other_messages,
|
||||
can_add_web_page_previews, can_change_info,
|
||||
can_invite_users, can_pin_messages)
|
||||
can_invite_users, can_pin_messages, use_independent_chat_permissions)
|
||||
|
||||
def promote_chat_member(
|
||||
self, chat_id: Union[int, str], user_id: int,
|
||||
|
@ -972,7 +972,7 @@ def restrict_chat_member(
|
||||
can_send_messages=None, can_send_media_messages=None,
|
||||
can_send_polls=None, can_send_other_messages=None,
|
||||
can_add_web_page_previews=None, can_change_info=None,
|
||||
can_invite_users=None, can_pin_messages=None):
|
||||
can_invite_users=None, can_pin_messages=None, use_independent_chat_permissions=None):
|
||||
method_url = 'restrictChatMember'
|
||||
permissions = {}
|
||||
if can_send_messages is not None:
|
||||
@ -991,6 +991,9 @@ def restrict_chat_member(
|
||||
permissions['can_invite_users'] = can_invite_users
|
||||
if can_pin_messages is not None:
|
||||
permissions['can_pin_messages'] = can_pin_messages
|
||||
if use_independent_chat_permissions is not None:
|
||||
permissions['use_independent_chat_permissions'] = use_independent_chat_permissions
|
||||
|
||||
permissions_json = json.dumps(permissions)
|
||||
payload = {'chat_id': chat_id, 'user_id': user_id, 'permissions': permissions_json}
|
||||
if until_date is not None:
|
||||
|
@ -3775,7 +3775,8 @@ class AsyncTeleBot:
|
||||
can_add_web_page_previews: Optional[bool]=None,
|
||||
can_change_info: Optional[bool]=None,
|
||||
can_invite_users: Optional[bool]=None,
|
||||
can_pin_messages: Optional[bool]=None) -> bool:
|
||||
can_pin_messages: Optional[bool]=None,
|
||||
use_independent_chat_permissions: Optional[bool]=None) -> bool:
|
||||
"""
|
||||
Use this method to restrict a user in a supergroup.
|
||||
The bot must be an administrator in the supergroup for this to work and must have
|
||||
@ -3823,6 +3824,12 @@ class AsyncTeleBot:
|
||||
:param can_pin_messages: Pass True, if the user is allowed to pin messages. Ignored in public supergroups
|
||||
:type can_pin_messages: :obj:`bool`
|
||||
|
||||
:param use_independent_chat_permissions: Pass True if chat permissions are set independently. Otherwise,
|
||||
the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages,
|
||||
can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and
|
||||
can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.
|
||||
:type use_independent_chat_permissions: :obj:`bool`
|
||||
|
||||
:return: True on success
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
@ -3831,7 +3838,7 @@ class AsyncTeleBot:
|
||||
can_send_messages, can_send_media_messages,
|
||||
can_send_polls, can_send_other_messages,
|
||||
can_add_web_page_previews, can_change_info,
|
||||
can_invite_users, can_pin_messages)
|
||||
can_invite_users, can_pin_messages, use_independent_chat_permissions)
|
||||
|
||||
async def promote_chat_member(
|
||||
self, chat_id: Union[int, str], user_id: int,
|
||||
|
@ -964,7 +964,7 @@ async def restrict_chat_member(
|
||||
can_send_messages=None, can_send_media_messages=None,
|
||||
can_send_polls=None, can_send_other_messages=None,
|
||||
can_add_web_page_previews=None, can_change_info=None,
|
||||
can_invite_users=None, can_pin_messages=None):
|
||||
can_invite_users=None, can_pin_messages=None, use_independent_chat_permissions=None):
|
||||
method_url = 'restrictChatMember'
|
||||
permissions = {}
|
||||
if can_send_messages is not None:
|
||||
@ -983,6 +983,9 @@ async def restrict_chat_member(
|
||||
permissions['can_invite_users'] = can_invite_users
|
||||
if can_pin_messages is not None:
|
||||
permissions['can_pin_messages'] = can_pin_messages
|
||||
if use_independent_chat_permissions is not None:
|
||||
permissions['use_independent_chat_permissions'] = use_independent_chat_permissions
|
||||
|
||||
permissions_json = json.dumps(permissions)
|
||||
payload = {'chat_id': chat_id, 'user_id': user_id, 'permissions': permissions_json}
|
||||
if until_date is not None:
|
||||
|
Loading…
Reference in New Issue
Block a user