diff --git a/telebot/__init__.py b/telebot/__init__.py index 0e18273..e91eb4d 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -3431,6 +3431,24 @@ class TeleBot: """ 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, menu_button: types.MenuButton=None) -> bool: diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 4d5000e..3807f24 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -1160,6 +1160,7 @@ def set_my_description(token, description=None, language_code=None): if language_code: payload['language_code'] = language_code return _make_request(token, method_url, params=payload, method='post') + def get_my_description(token, language_code=None): method_url = r'getMyDescription' @@ -1168,6 +1169,15 @@ def get_my_description(token, language_code=None): payload['language_code'] = language_code 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): method_url = r'getMyCommands' payload = {} diff --git a/telebot/async_telebot.py b/telebot/async_telebot.py index 142867a..0e1c51e 100644 --- a/telebot/async_telebot.py +++ b/telebot/async_telebot.py @@ -4269,6 +4269,24 @@ class AsyncTeleBot: result = await asyncio_helper.get_my_description(self.token, language_code) 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], language_code: Optional[str]) -> List[types.BotCommand]: """ diff --git a/telebot/asyncio_helper.py b/telebot/asyncio_helper.py index 0b132e9..2460dd5 100644 --- a/telebot/asyncio_helper.py +++ b/telebot/asyncio_helper.py @@ -1154,6 +1154,14 @@ async def get_my_description(token, language_code=None): payload['language_code'] = language_code 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): method_url = r'getMyCommands'