From 8bf80a15b3cfd83fcaabd6627e7dc8bd1a44047b Mon Sep 17 00:00:00 2001 From: Oleg A Date: Thu, 9 Mar 2023 21:35:51 +0300 Subject: [PATCH] feat: add setMyDescription #1140 --- aiogram/bot/api.py | 1 + aiogram/bot/bot.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/aiogram/bot/api.py b/aiogram/bot/api.py index ef1d24be..c74458a1 100644 --- a/aiogram/bot/api.py +++ b/aiogram/bot/api.py @@ -268,6 +268,7 @@ class Methods(Helper): SET_MY_COMMANDS = Item() # setMyCommands DELETE_MY_COMMANDS = Item() # deleteMyCommands GET_MY_COMMANDS = Item() # getMyCommands + SET_MY_DESCRIPTION = Item() # setMyDescription # Updating messages EDIT_MESSAGE_TEXT = Item() # editMessageText diff --git a/aiogram/bot/bot.py b/aiogram/bot/bot.py index 54aad263..49549108 100644 --- a/aiogram/bot/bot.py +++ b/aiogram/bot/bot.py @@ -2983,6 +2983,35 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): result = await self.request(api.Methods.GET_MY_COMMANDS, payload) return [types.BotCommand(**bot_command_data) for bot_command_data in result] + async def set_my_description( + self, + description: typing.Optional[base.String] = None, + language_code: typing.Optional[base.String] = None, + ) -> base.Boolean: + """ + Use this method to change the bot's description, which is shown + in the chat with the bot if the chat is empty. + + + Source: https://core.telegram.org/bots/api#setmydescription + + :param description: New bot description; 0-512 characters. + Pass an empty string to remove the dedicated description for + the given language. + :type description: :obj: `typing.Optional[base.String]` + + :param language_code: A two-letter ISO 639-1 language code. If + empty, the description will be applied to all users for + whose language there is no dedicated description. + :type language_code: :obj: `typing.Optional[base.String]` + + :return: Returns True on success. + :rtype: :obj:`base.Boolean` + """ + payload = generate_payload(**locals()) + + return await self.request(api.Methods.SET_MY_DESCRIPTION, payload) + async def set_chat_menu_button(self, chat_id: typing.Optional[base.Integer] = None, menu_button: typing.Optional[types.MenuButton] = None) -> bool: """