setMyCommands implemented

This commit is contained in:
bcmk 2020-09-27 00:55:26 +04:00
parent b263943220
commit 4a2c8c4547
2 changed files with 21 additions and 0 deletions

15
bot.go
View file

@ -1036,3 +1036,18 @@ func (bot *BotAPI) GetStickerSet(config GetStickerSetConfig) (StickerSet, error)
}
return stickerSet, nil
}
// SetMyCommands changes the list of the bot's commands.
func (bot *BotAPI) SetMyCommands(commands []BotCommand) error {
v := url.Values{}
data, err := json.Marshal(commands)
if err != nil {
return err
}
v.Add("commands", string(data))
_, err = bot.MakeRequest("setMyCommands", v)
if err != nil {
return err
}
return nil
}