コード例 #1
0
ファイル: commands_test.go プロジェクト: Syfaro/finch
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
ファイル: minecraft.go プロジェクト: Syfaro/finch-example
func (cmd *minecraftCommand) ShouldExecute(update tgbotapi.Update) bool {
	return finch.SimpleCommand("mc", update.Message.Text)
}
コード例 #3
0
ファイル: printerfacts.go プロジェクト: Xe/flurryheart
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
ファイル: select_item.go プロジェクト: Syfaro/selectionsbot
func (cmd selectItem) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("select", message.Text)
}
コード例 #10
0
ファイル: count_items.go プロジェクト: Syfaro/selectionsbot
func (cmd countItems) ShouldExecute(message tgbotapi.Message) bool {
	return finch.SimpleCommand("count", message.Text)
}
コード例 #11
0
ファイル: start.go プロジェクト: Syfaro/selectionsbot
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)
}