Updates for Bot API 4.7.

This commit is contained in:
Syfaro 2020-03-30 15:35:53 -05:00
parent 6ce4ec747d
commit 75e27e1380
5 changed files with 194 additions and 11 deletions

View file

@ -733,3 +733,44 @@ func TestPolls(t *testing.T) {
t.Fail()
}
}
func TestSendDice(t *testing.T) {
bot, _ := getBot(t)
dice := NewSendDice(ChatID)
msg, err := bot.Send(dice)
if err != nil {
t.Error("Unable to send dice roll")
}
if msg.Dice == nil {
t.Error("Dice roll was not received")
}
}
func TestSetCommands(t *testing.T) {
bot, _ := getBot(t)
setCommands := NewSetMyCommands(BotCommand{
Command: "test",
Description: "a test command",
})
if _, err := bot.Request(setCommands); err != nil {
t.Error("Unable to set commands")
}
commands, err := bot.GetMyCommands()
if err != nil {
t.Error("Unable to get commands")
}
if len(commands) != 1 {
t.Error("Incorrect number of commands returned")
}
if commands[0].Command != "test" || commands[0].Description != "a test command" {
t.Error("Commands were incorrectly set")
}
}