1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

UPG: Add ChatPermissions, set_chat_permissions

This commit is contained in:
Anthony Byuraev
2020-05-11 16:38:09 +03:00
parent a80927baf9
commit a60253bf60
3 changed files with 82 additions and 3 deletions

View File

@@ -547,9 +547,11 @@ class TeleBot:
def get_chat_administrators(self, chat_id):
"""
Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects
that contains information about all chat administrators except other bots.
:param chat_id:
Use this method to get a list of administrators in a chat.
On success, returns an Array of ChatMember objects that contains
information about all chat administrators except other bots.
:param chat_id: Unique identifier for the target chat or username
of the target supergroup or channel (in the format @channelusername)
:return:
"""
result = apihelper.get_chat_administrators(self.token, chat_id)
@@ -999,6 +1001,19 @@ class TeleBot:
"""
return apihelper.set_chat_administrator_custom_title(self.token, chat_id, user_id, custom_title)
def set_chat_permissions(self, chat_id, permissions):
"""
Use this method to set default chat permissions for all members.
The bot must be an administrator in the group or a supergroup for this to work
and must have the can_restrict_members admin rights.
:param chat_id: Unique identifier for the target chat or username of the target supergroup
(in the format @supergroupusername)
:param permissions: New default chat permissions
:return:
"""
return apihelper.set_chat_permissions(self.token, chat_id, permissions)
def export_chat_invite_link(self, chat_id):
"""
Use this method to export an invite link to a supergroup or a channel. The bot must be an administrator