Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -1473,20 +1473,10 @@ func (b *Bot) SetCommands(opts ...interface{}) error {
}

// DeleteCommands deletes the list of the bot's commands for the given scope and user language.
func (b *Bot) DeleteCommands(opts ...interface{}) ([]Command, error) {
func (b *Bot) DeleteCommands(opts ...interface{}) error {
params := extractCommandsParams(opts...)
data, err := b.Raw("deleteMyCommands", params)
if err != nil {
return nil, err
}

var resp struct {
Result []Command
}
if err := json.Unmarshal(data, &resp); err != nil {
return nil, wrapError(err)
}
return resp.Result, nil
_, err := b.Raw("deleteMyCommands", params)
return err
}

// Logout logs out from the cloud Bot API server before launching the bot locally.
Expand Down
4 changes: 4 additions & 0 deletions bot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,10 @@ func TestBot(t *testing.T) {
cmds, err = b.Commands(CommandScope{Type: CommandScopeChat, ChatID: chatID}, "en")
require.NoError(t, err)
assert.Equal(t, orig2, cmds)

require.NoError(t, b.DeleteCommands(CommandScope{Type: CommandScopeChat, ChatID: chatID}, "en"))

require.NoError(t, b.DeleteCommands())
})

t.Run("CreateInviteLink", func(t *testing.T) {
Expand Down