Updates for Bot API 5.3.
This commit is contained in:
parent
fb1de2fb48
commit
66dc9e8246
6 changed files with 179 additions and 10 deletions
26
bot_test.go
26
bot_test.go
|
@ -953,7 +953,7 @@ func TestSendDice(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSetCommands(t *testing.T) {
|
||||
func TestCommands(t *testing.T) {
|
||||
bot, _ := getBot(t)
|
||||
|
||||
setCommands := NewSetMyCommands(BotCommand{
|
||||
|
@ -965,7 +965,7 @@ func TestSetCommands(t *testing.T) {
|
|||
t.Error("Unable to set commands")
|
||||
}
|
||||
|
||||
commands, err := bot.GetMyCommands()
|
||||
commands, err := bot.GetMyCommands(NewGetMyCommands())
|
||||
if err != nil {
|
||||
t.Error("Unable to get commands")
|
||||
}
|
||||
|
@ -977,6 +977,28 @@ func TestSetCommands(t *testing.T) {
|
|||
if commands[0].Command != "test" || commands[0].Description != "a test command" {
|
||||
t.Error("Commands were incorrectly set")
|
||||
}
|
||||
|
||||
setCommands = NewSetMyCommandsWithScope(NewBotCommandScopeAllPrivateChats(), BotCommand{
|
||||
Command: "private",
|
||||
Description: "a private command",
|
||||
})
|
||||
|
||||
if _, err := bot.Request(setCommands); err != nil {
|
||||
t.Error("Unable to set commands")
|
||||
}
|
||||
|
||||
commands, err = bot.GetMyCommands(NewGetMyCommandsWithScope(NewBotCommandScopeAllPrivateChats()))
|
||||
if err != nil {
|
||||
t.Error("Unable to get commands")
|
||||
}
|
||||
|
||||
if len(commands) != 1 {
|
||||
t.Error("Incorrect number of commands returned")
|
||||
}
|
||||
|
||||
if commands[0].Command != "private" || commands[0].Description != "a private command" {
|
||||
t.Error("Commands were incorrectly set")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEditMessageMedia(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue