Skip to content

Commit 4a2c8c4

Browse files
committed
setMyCommands implemented
1 parent b263943 commit 4a2c8c4

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

bot.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,3 +1036,18 @@ func (bot *BotAPI) GetStickerSet(config GetStickerSetConfig) (StickerSet, error)
10361036
}
10371037
return stickerSet, nil
10381038
}
1039+
1040+
// SetMyCommands changes the list of the bot's commands.
1041+
func (bot *BotAPI) SetMyCommands(commands []BotCommand) error {
1042+
v := url.Values{}
1043+
data, err := json.Marshal(commands)
1044+
if err != nil {
1045+
return err
1046+
}
1047+
v.Add("commands", string(data))
1048+
_, err = bot.MakeRequest("setMyCommands", v)
1049+
if err != nil {
1050+
return err
1051+
}
1052+
return nil
1053+
}

types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,3 +1005,9 @@ type Error struct {
10051005
func (e Error) Error() string {
10061006
return e.Message
10071007
}
1008+
1009+
// BotCommand represents a bot command.
1010+
type BotCommand struct {
1011+
Command string `json:"command"`
1012+
Description string `json:"description"`
1013+
}

0 commit comments

Comments
 (0)