From 1198abda6d662e8d8fe90e53f6c0e1cc9e56dcb7 Mon Sep 17 00:00:00 2001 From: Syfaro Date: Fri, 20 Aug 2021 01:27:42 -0400 Subject: [PATCH] Avoid breaking change with GetMyCommands. --- bot.go | 7 ++++++- bot_test.go | 4 ++-- helpers.go | 5 ----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bot.go b/bot.go index ad098af..0d051dd 100644 --- a/bot.go +++ b/bot.go @@ -667,7 +667,12 @@ func (bot *BotAPI) StopPoll(config StopPollConfig) (Poll, error) { } // GetMyCommands gets the currently registered commands. -func (bot *BotAPI) GetMyCommands(config GetMyCommandsConfig) ([]BotCommand, error) { +func (bot *BotAPI) GetMyCommands() ([]BotCommand, error) { + return bot.GetMyCommandsWithConfig(GetMyCommandsConfig{}) +} + +// GetMyCommandsWithConfig gets the currently registered commands with a config. +func (bot *BotAPI) GetMyCommandsWithConfig(config GetMyCommandsConfig) ([]BotCommand, error) { resp, err := bot.Request(config) if err != nil { return nil, err diff --git a/bot_test.go b/bot_test.go index 3a9e438..b1ba8aa 100644 --- a/bot_test.go +++ b/bot_test.go @@ -965,7 +965,7 @@ func TestCommands(t *testing.T) { t.Error("Unable to set commands") } - commands, err := bot.GetMyCommands(NewGetMyCommands()) + commands, err := bot.GetMyCommands() if err != nil { t.Error("Unable to get commands") } @@ -987,7 +987,7 @@ func TestCommands(t *testing.T) { t.Error("Unable to set commands") } - commands, err = bot.GetMyCommands(NewGetMyCommandsWithScope(NewBotCommandScopeAllPrivateChats())) + commands, err = bot.GetMyCommandsWithConfig(NewGetMyCommandsWithScope(NewBotCommandScopeAllPrivateChats())) if err != nil { t.Error("Unable to get commands") } diff --git a/helpers.go b/helpers.go index f9ad399..fc2a89d 100644 --- a/helpers.go +++ b/helpers.go @@ -888,11 +888,6 @@ func NewBotCommandScopeChatMember(chatID, userID int64) BotCommandScope { } } -// NewGetMyCommands allows you to set the registered commands. -func NewGetMyCommands() GetMyCommandsConfig { - return GetMyCommandsConfig{} -} - // NewGetMyCommandsWithScope allows you to set the registered commands for a // given scope. func NewGetMyCommandsWithScope(scope BotCommandScope) GetMyCommandsConfig {