feat: add getMyDescription

#1140
This commit is contained in:
Oleg A 2023-03-09 21:43:04 +03:00
parent 8bf80a15b3
commit 1667a4d46e
No known key found for this signature in database
GPG key ID: 5FE046817A9657C5
4 changed files with 35 additions and 0 deletions

View file

@ -269,6 +269,7 @@ class Methods(Helper):
DELETE_MY_COMMANDS = Item() # deleteMyCommands
GET_MY_COMMANDS = Item() # getMyCommands
SET_MY_DESCRIPTION = Item() # setMyDescription
GET_MY_DESCRIPTION = Item() # getMyDescription
# Updating messages
EDIT_MESSAGE_TEXT = Item() # editMessageText

View file

@ -3012,6 +3012,28 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
return await self.request(api.Methods.SET_MY_DESCRIPTION, payload)
async def get_my_description(
self,
language_code: typing.Optional[base.String] = None,
) -> types.BotDescription:
"""
Use this method to get the current bot description for the given
user language.
Source: https://core.telegram.org/bots/api#getmydescription
:param language_code: A two-letter ISO 639-1 language code or an
empty string
:type language_code: :obj: `typing.Optional[base.String]`
:return: Returns BotDescription on success.
:rtype: :obj:`types.BotDescription`
"""
payload = generate_payload(**locals())
result = await self.request(api.Methods.GET_MY_DESCRIPTION, payload)
return types.BotDescription(**result)
async def set_chat_menu_button(self, chat_id: typing.Optional[base.Integer] = None,
menu_button: typing.Optional[types.MenuButton] = None) -> bool:
"""

View file

@ -8,6 +8,7 @@ from .bot_command_scope import BotCommandScope, BotCommandScopeAllChatAdministra
BotCommandScopeAllGroupChats, BotCommandScopeAllPrivateChats, BotCommandScopeChat, \
BotCommandScopeChatAdministrators, BotCommandScopeChatMember, \
BotCommandScopeDefault, BotCommandScopeType
from .bot_description import BotDescription
from .callback_game import CallbackGame
from .callback_query import CallbackQuery
from .chat import Chat, ChatActions, ChatType
@ -118,6 +119,7 @@ __all__ = (
'BotCommandScopeChatMember',
'BotCommandScopeDefault',
'BotCommandScopeType',
'BotDescription',
'CallbackGame',
'CallbackQuery',
'Chat',

View file

@ -0,0 +1,10 @@
from . import base, fields
class BotDescription(base.TelegramObject):
"""
This object represents the bot's description.
https://core.telegram.org/bots/api#botdescription
"""
description: base.String = fields.Field()