feat: add getMyShortDescription

#1140
This commit is contained in:
Oleg A 2023-03-09 21:50:52 +03:00
parent ef1d4ae94d
commit eb922690fc
No known key found for this signature in database
GPG key ID: 5FE046817A9657C5
4 changed files with 35 additions and 0 deletions

View file

@ -271,6 +271,7 @@ class Methods(Helper):
SET_MY_DESCRIPTION = Item() # setMyDescription
GET_MY_DESCRIPTION = Item() # getMyDescription
SET_MY_SHORT_DESCRIPTION = Item() # setMyShortDescription
GET_MY_SHORT_DESCRIPTION = Item() # getMyShortDescription
# Updating messages
EDIT_MESSAGE_TEXT = Item() # editMessageText

View file

@ -3063,6 +3063,28 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
return await self.request(api.Methods.SET_MY_SHORT_DESCRIPTION, payload)
async def get_my_short_description(
self,
language_code: typing.Optional[base.String] = None,
) -> types.BotShortDescription:
"""
Use this method to get the current bot short description for the
given user language.
Source: https://core.telegram.org/bots/api#getmyshortdescription
: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 BotShortDescription on success.
:rtype: :obj:`types.BotShortDescription`
"""
payload = generate_payload(**locals())
result = await self.request(api.Methods.GET_MY_SHORT_DESCRIPTION, payload)
return types.BotShortDescription(**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

@ -9,6 +9,7 @@ from .bot_command_scope import BotCommandScope, BotCommandScopeAllChatAdministra
BotCommandScopeChatAdministrators, BotCommandScopeChatMember, \
BotCommandScopeDefault, BotCommandScopeType
from .bot_description import BotDescription
from .bot_short_description import BotShortDescription
from .callback_game import CallbackGame
from .callback_query import CallbackQuery
from .chat import Chat, ChatActions, ChatType
@ -120,6 +121,7 @@ __all__ = (
'BotCommandScopeDefault',
'BotCommandScopeType',
'BotDescription',
'BotShortDescription',
'CallbackGame',
'CallbackQuery',
'Chat',

View file

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