Avoid breaking change with GetMyCommands.
parent
66dc9e8246
commit
1198abda6d
7
bot.go
7
bot.go
|
@ -667,7 +667,12 @@ func (bot *BotAPI) StopPoll(config StopPollConfig) (Poll, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMyCommands gets the currently registered commands.
|
// 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)
|
resp, err := bot.Request(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -965,7 +965,7 @@ func TestCommands(t *testing.T) {
|
||||||
t.Error("Unable to set commands")
|
t.Error("Unable to set commands")
|
||||||
}
|
}
|
||||||
|
|
||||||
commands, err := bot.GetMyCommands(NewGetMyCommands())
|
commands, err := bot.GetMyCommands()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Unable to get commands")
|
t.Error("Unable to get commands")
|
||||||
}
|
}
|
||||||
|
@ -987,7 +987,7 @@ func TestCommands(t *testing.T) {
|
||||||
t.Error("Unable to set commands")
|
t.Error("Unable to set commands")
|
||||||
}
|
}
|
||||||
|
|
||||||
commands, err = bot.GetMyCommands(NewGetMyCommandsWithScope(NewBotCommandScopeAllPrivateChats()))
|
commands, err = bot.GetMyCommandsWithConfig(NewGetMyCommandsWithScope(NewBotCommandScopeAllPrivateChats()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Unable to get commands")
|
t.Error("Unable to get commands")
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
// NewGetMyCommandsWithScope allows you to set the registered commands for a
|
||||||
// given scope.
|
// given scope.
|
||||||
func NewGetMyCommandsWithScope(scope BotCommandScope) GetMyCommandsConfig {
|
func NewGetMyCommandsWithScope(scope BotCommandScope) GetMyCommandsConfig {
|
||||||
|
|
Loading…
Reference in New Issue