From e7590a0638df29ec1e28568b1195362642daf74a Mon Sep 17 00:00:00 2001 From: bcmk <45658475+bcmk@users.noreply.github.com> Date: Sun, 27 Sep 2020 01:54:11 +0400 Subject: [PATCH] getMyCommands implemented --- bot.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bot.go b/bot.go index 83903d4..cffe4c2 100644 --- a/bot.go +++ b/bot.go @@ -1037,6 +1037,20 @@ func (bot *BotAPI) GetStickerSet(config GetStickerSetConfig) (StickerSet, error) 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{}