getMyCommands implemented
bcmk 45658475+bcmk@users.noreply.github.com
Sun, 27 Sep 2020 01:54:11 +0400
1 files changed,
14 insertions(+),
0 deletions(-)
jump to
M
bot.go
→
bot.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{}