all repos — telegram-bot-api @ e7590a0638df29ec1e28568b1195362642daf74a

Golang bindings for the Telegram Bot API

getMyCommands implemented
bcmk 45658475+bcmk@users.noreply.github.com
Sun, 27 Sep 2020 01:54:11 +0400
commit

e7590a0638df29ec1e28568b1195362642daf74a

parent

4a2c8c4547a868841c1ec088302b23b59443de2b

1 files changed, 14 insertions(+), 0 deletions(-)

jump to
M bot.gobot.go

@@ -1037,6 +1037,20 @@ }

return stickerSet, nil } +// GetMyCommands gets the current list of the bot's commands. +func (bot *BotAPI) GetMyCommands() ([]BotCommand, error) { + res, err := bot.MakeRequest("getMyCommands", nil) + if err != nil { + return nil, err + } + var commands []BotCommand + err = json.Unmarshal(res.Result, &commands) + if err != nil { + return nil, err + } + return commands, nil +} + // SetMyCommands changes the list of the bot's commands. func (bot *BotAPI) SetMyCommands(commands []BotCommand) error { v := url.Values{}