Exemple #1
0
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")
	}
}
Exemple #2
0
func (cmd *minecraftCommand) ShouldExecute(update tgbotapi.Update) bool {
	return finch.SimpleCommand("mc", update.Message.Text)
}
Exemple #3
0
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)
}
Exemple #5
0
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)
}
Exemple #7
0
func (cmd *infoCommand) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("info", message.Text)
}
Exemple #8
0
func (cancelCommand) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("cancel", message.Text)
}
Exemple #9
0
func (cmd selectItem) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("select", message.Text)
}
Exemple #10
0
func (cmd countItems) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("count", message.Text)
}
Exemple #11
0
func (cmd start) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("start", message.Text)
}
Exemple #12
0
func (cmd helpCommand) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("help", message.Text)
}