mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Added the ability to set different bot short descriptions for different user languages using the method setMyShortDescription.
This commit is contained in:
parent
65dcd67140
commit
9b81a29a6a
@ -3432,6 +3432,24 @@ class TeleBot:
|
|||||||
|
|
||||||
return types.BotDescription.de_json(apihelper.get_my_description(self.token, language_code))
|
return types.BotDescription.de_json(apihelper.get_my_description(self.token, language_code))
|
||||||
|
|
||||||
|
def set_my_short_description(self, short_description:Optional[str]=None, language_code:Optional[str]=None):
|
||||||
|
"""
|
||||||
|
Use this method to change the bot's short description, which is shown on the bot's profile page and
|
||||||
|
is sent together with the link when users share the bot.
|
||||||
|
Returns True on success.
|
||||||
|
|
||||||
|
:param short_description: New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.
|
||||||
|
:type short_description: :obj:`str`
|
||||||
|
|
||||||
|
:param language_code: A two-letter ISO 639-1 language code.
|
||||||
|
If empty, the short description will be applied to all users for whose language there is no dedicated short description.
|
||||||
|
:type language_code: :obj:`str`
|
||||||
|
|
||||||
|
:return: True on success.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return apihelper.set_my_short_description(self.token, short_description, language_code)
|
||||||
|
|
||||||
def set_chat_menu_button(self, chat_id: Union[int, str]=None,
|
def set_chat_menu_button(self, chat_id: Union[int, str]=None,
|
||||||
menu_button: types.MenuButton=None) -> bool:
|
menu_button: types.MenuButton=None) -> bool:
|
||||||
"""
|
"""
|
||||||
|
@ -1161,6 +1161,7 @@ def set_my_description(token, description=None, language_code=None):
|
|||||||
payload['language_code'] = language_code
|
payload['language_code'] = language_code
|
||||||
return _make_request(token, method_url, params=payload, method='post')
|
return _make_request(token, method_url, params=payload, method='post')
|
||||||
|
|
||||||
|
|
||||||
def get_my_description(token, language_code=None):
|
def get_my_description(token, language_code=None):
|
||||||
method_url = r'getMyDescription'
|
method_url = r'getMyDescription'
|
||||||
payload = {}
|
payload = {}
|
||||||
@ -1168,6 +1169,15 @@ def get_my_description(token, language_code=None):
|
|||||||
payload['language_code'] = language_code
|
payload['language_code'] = language_code
|
||||||
return _make_request(token, method_url, params=payload)
|
return _make_request(token, method_url, params=payload)
|
||||||
|
|
||||||
|
def set_my_short_description(token, short_description=None, language_code=None):
|
||||||
|
method_url = r'setMyShortDescription'
|
||||||
|
payload = {}
|
||||||
|
if short_description:
|
||||||
|
payload['short_description'] = short_description
|
||||||
|
if language_code:
|
||||||
|
payload['language_code'] = language_code
|
||||||
|
return _make_request(token, method_url, params=payload, method='post')
|
||||||
|
|
||||||
def get_my_commands(token, scope=None, language_code=None):
|
def get_my_commands(token, scope=None, language_code=None):
|
||||||
method_url = r'getMyCommands'
|
method_url = r'getMyCommands'
|
||||||
payload = {}
|
payload = {}
|
||||||
|
@ -4269,6 +4269,24 @@ class AsyncTeleBot:
|
|||||||
result = await asyncio_helper.get_my_description(self.token, language_code)
|
result = await asyncio_helper.get_my_description(self.token, language_code)
|
||||||
return types.BotDescription.de_json(result)
|
return types.BotDescription.de_json(result)
|
||||||
|
|
||||||
|
async def set_my_short_description(self, short_description:Optional[str]=None, language_code:Optional[str]=None):
|
||||||
|
"""
|
||||||
|
Use this method to change the bot's short description, which is shown on the bot's profile page and
|
||||||
|
is sent together with the link when users share the bot.
|
||||||
|
Returns True on success.
|
||||||
|
|
||||||
|
:param short_description: New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.
|
||||||
|
:type short_description: :obj:`str`
|
||||||
|
|
||||||
|
:param language_code: A two-letter ISO 639-1 language code.
|
||||||
|
If empty, the short description will be applied to all users for whose language there is no dedicated short description.
|
||||||
|
:type language_code: :obj:`str`
|
||||||
|
|
||||||
|
:return: True on success.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return await asyncio_helper.set_my_short_description(self.token, short_description, language_code)
|
||||||
|
|
||||||
async def get_my_commands(self, scope: Optional[types.BotCommandScope],
|
async def get_my_commands(self, scope: Optional[types.BotCommandScope],
|
||||||
language_code: Optional[str]) -> List[types.BotCommand]:
|
language_code: Optional[str]) -> List[types.BotCommand]:
|
||||||
"""
|
"""
|
||||||
|
@ -1154,6 +1154,14 @@ async def get_my_description(token, language_code=None):
|
|||||||
payload['language_code'] = language_code
|
payload['language_code'] = language_code
|
||||||
return await _process_request(token, method_url, params=payload)
|
return await _process_request(token, method_url, params=payload)
|
||||||
|
|
||||||
|
async def set_my_short_description(token, short_description=None, language_code=None):
|
||||||
|
method_url = r'setMyShortDescription'
|
||||||
|
payload = {}
|
||||||
|
if short_description:
|
||||||
|
payload['short_description'] = short_description
|
||||||
|
if language_code:
|
||||||
|
payload['language_code'] = language_code
|
||||||
|
return await _process_request(token, method_url, params=payload, method='post')
|
||||||
|
|
||||||
async def get_my_commands(token, scope=None, language_code=None):
|
async def get_my_commands(token, scope=None, language_code=None):
|
||||||
method_url = r'getMyCommands'
|
method_url = r'getMyCommands'
|
||||||
|
Loading…
Reference in New Issue
Block a user