mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
#289 added getMyCommands method
This commit is contained in:
parent
b77ed1ad92
commit
c8f126b8ea
2 changed files with 15 additions and 1 deletions
|
|
@ -207,6 +207,7 @@ class Methods(Helper):
|
|||
DELETE_CHAT_STICKER_SET = Item() # deleteChatStickerSet
|
||||
ANSWER_CALLBACK_QUERY = Item() # answerCallbackQuery
|
||||
SET_MY_COMMANDS = Item() # setMyCommands
|
||||
GET_MY_COMMANDS = Item() # getMyCommands
|
||||
|
||||
# Updating messages
|
||||
EDIT_MESSAGE_TEXT = Item() # editMessageText
|
||||
|
|
|
|||
|
|
@ -1530,7 +1530,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
|||
At most 100 commands can be specified.
|
||||
:type commands: :obj: `typing.List[types.BotCommand]`
|
||||
:return: Returns True on success.
|
||||
:rtype: base.Boolean
|
||||
:rtype: :obj:`base.Boolean`
|
||||
"""
|
||||
commands = prepare_arg(commands)
|
||||
payload = generate_payload(**locals())
|
||||
|
|
@ -1538,6 +1538,19 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
|||
result = await self.request(api.Methods.SET_MY_COMMANDS, payload)
|
||||
return result
|
||||
|
||||
async def get_my_commands(self) -> typing.List[types.BotCommand]:
|
||||
"""
|
||||
Use this method to get the current list of the bot's commands.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getmycommands
|
||||
:return: Returns Array of BotCommand on success.
|
||||
:rtype: :obj:`typing.List[types.BotCommand]`
|
||||
"""
|
||||
payload = generate_payload(**locals())
|
||||
|
||||
result = await self.request(api.Methods.GET_MY_COMMANDS, payload)
|
||||
return result
|
||||
|
||||
async def edit_message_text(self, text: base.String,
|
||||
chat_id: typing.Union[base.Integer, base.String, None] = None,
|
||||
message_id: typing.Union[base.Integer, None] = None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue