예제 #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")
	}
}
예제 #2
0
func (cmd *minecraftCommand) ShouldExecute(update tgbotapi.Update) bool {
	return finch.SimpleCommand("mc", update.Message.Text)
}
예제 #3
0
func (cmd *printerfactCommand) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("printerfact", message.Text)
}
예제 #4
0
func (cmd selectionList) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("list", message.Text)
}
예제 #5
0
파일: countdown.go 프로젝트: Xe/flurryheart
func (cmd *countdownCommand) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("countdown", message.Text)
}
예제 #6
0
func (cmd createSelection) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("create", message.Text)
}
예제 #7
0
파일: info.go 프로젝트: Syfaro/finch
func (cmd *infoCommand) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("info", message.Text)
}
예제 #8
0
파일: cancel.go 프로젝트: Syfaro/finch
func (cancelCommand) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("cancel", message.Text)
}
예제 #9
0
func (cmd selectItem) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("select", message.Text)
}
예제 #10
0
func (cmd countItems) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("count", message.Text)
}
예제 #11
0
func (cmd start) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("start", message.Text)
}
예제 #12
0
파일: help.go 프로젝트: Syfaro/finch
func (cmd helpCommand) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("help", message.Text)
}