UPG: add setChatAdministratorCustomTitle

This commit is contained in:
Anthony Byuraev 2020-05-09 23:23:08 +03:00
parent 8be9bcc8ed
commit a80927baf9
2 changed files with 21 additions and 1 deletions

View File

@ -985,6 +985,20 @@ class TeleBot:
can_edit_messages, can_delete_messages, can_invite_users,
can_restrict_members, can_pin_messages, can_promote_members)
def set_chat_administrator_custom_title(self, chat_id, user_id, custom_title):
"""
Use this method to set a custom title for an administrator
in a supergroup promoted by the bot.
Returns True on success.
:param chat_id: Unique identifier for the target chat or username of the target supergroup
(in the format @supergroupusername)
:param user_id: Unique identifier of the target user
:param custom_title: New custom title for the administrator;
0-16 characters, emoji are not allowed
:return:
"""
return apihelper.set_chat_administrator_custom_title(self.token, chat_id, user_id, custom_title)
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

View File

@ -586,7 +586,6 @@ def restrict_chat_member(token, chat_id, user_id, until_date=None, can_send_mess
payload['can_add_web_page_previews'] = can_add_web_page_previews
if can_invite_users:
payload['can_invite_users'] = can_invite_users
return _make_request(token, method_url, params=payload, method='post')
@ -614,6 +613,13 @@ def promote_chat_member(token, chat_id, user_id, can_change_info=None, can_post_
return _make_request(token, method_url, params=payload, method='post')
def set_chat_administrator_custom_title(token, chat_id, user_id, custom_title):
method_url = 'setChatAdministratorCustomTitle'
payload = {
'chat_id': chat_id, 'user_id': user_id, 'custom_title': custom_title}
return _make_request(token, method_url, params=payload, method='post')
def export_chat_invite_link(token, chat_id):
method_url = 'exportChatInviteLink'
payload = {'chat_id': chat_id}