getMyCommands implemented

bot-api-6.1
bcmk 2020-09-27 01:54:11 +04:00
parent 4a2c8c4547
commit e7590a0638
1 changed files with 14 additions and 0 deletions

14
bot.go
View File

@ -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{}