func TestSimpleCommand(t *testing.T) { goodMessage := "/start" goodMessage2 := "/start param1 param2" goodMessage3 := "/start@FinchExampleBot" goodMessage4 := "/start@FinchExampleBot param1 param2" badMessage := "/stop" if !finch.SimpleCommand("start", goodMessage) { t.Error("goodMessage did not return true") } if !finch.SimpleCommand("start", goodMessage2) { t.Error("goodMessage2 did not return true") } if !finch.SimpleCommand("start", goodMessage3) { t.Error("goodMessage3 did not return true") } if !finch.SimpleCommand("start", goodMessage4) { t.Error("goodMessage4 did not return true") } if finch.SimpleCommand("start", badMessage) { t.Error("badMessage did not return false") } }
func (cmd *minecraftCommand) ShouldExecute(update tgbotapi.Update) bool { return finch.SimpleCommand("mc", update.Message.Text) }
func (cmd *printerfactCommand) ShouldExecute(message tgbotapi.Message) bool { return finch.SimpleCommand("printerfact", message.Text) }
func (cmd selectionList) ShouldExecute(message tgbotapi.Message) bool { return finch.SimpleCommand("list", message.Text) }
func (cmd *countdownCommand) ShouldExecute(message tgbotapi.Message) bool { return finch.SimpleCommand("countdown", message.Text) }
func (cmd createSelection) ShouldExecute(message tgbotapi.Message) bool { return finch.SimpleCommand("create", message.Text) }
func (cmd *infoCommand) ShouldExecute(message tgbotapi.Message) bool { return finch.SimpleCommand("info", message.Text) }
func (cancelCommand) ShouldExecute(message tgbotapi.Message) bool { return finch.SimpleCommand("cancel", message.Text) }
func (cmd selectItem) ShouldExecute(message tgbotapi.Message) bool { return finch.SimpleCommand("select", message.Text) }
func (cmd countItems) ShouldExecute(message tgbotapi.Message) bool { return finch.SimpleCommand("count", message.Text) }
func (cmd start) ShouldExecute(message tgbotapi.Message) bool { return finch.SimpleCommand("start", message.Text) }
func (cmd helpCommand) ShouldExecute(message tgbotapi.Message) bool { return finch.SimpleCommand("help", message.Text) }