all repos — telegram-bot-api @ 1198abda6d662e8d8fe90e53f6c0e1cc9e56dcb7

Golang bindings for the Telegram Bot API

Avoid breaking change with GetMyCommands.
Syfaro syfaro@huefox.com
Fri, 20 Aug 2021 01:27:42 -0400
commit

1198abda6d662e8d8fe90e53f6c0e1cc9e56dcb7

parent

66dc9e824616b3bb3c6531d9411e622417bd4f03

3 files changed, 8 insertions(+), 8 deletions(-)

jump to
M bot.gobot.go

@@ -667,7 +667,12 @@ return poll, err

} // 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
M bot_test.gobot_test.go

@@ -965,7 +965,7 @@ if _, err := bot.Request(setCommands); err != nil {

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 @@ if _, err := bot.Request(setCommands); err != nil {

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") }
M helpers.gohelpers.go

@@ -888,11 +888,6 @@ UserID: userID,

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