コード例 #1
0
ファイル: slackbot.go プロジェクト: 135yshr/slackbot
func NewBotContext(token string) (BotContext, error) {
	ctx, err := NewBotContextNotSysstd(token)
	if err != nil {
		return nil, err
	}
	ctx.AddPlugin("sysstd", sysstd.NewPlugin(ctx.PluginManager()))

	return ctx, nil
}
コード例 #2
0
ファイル: sysstd_test.go プロジェクト: 135yshr/slackbot
func TestDoAction(t *testing.T) {
	p := sysstd.NewPlugin(nil)

	next := p.DoAction(testEvent, "date a 1 3")

	if next != false {
		t.Errorf("ERROR next != false")
	}
}
コード例 #3
0
ファイル: sysstd_test.go プロジェクト: 135yshr/slackbot
func TestCheckMessage(t *testing.T) {
	p := sysstd.NewPlugin(nil)
	ok, message := p.CheckMessage(testEvent, testEvent.BaseText())
	if !ok {
		t.Errorf("ERROR check = NG")
	} else {
		fmt.Println(message)
	}
}
コード例 #4
0
ファイル: sysstd_test.go プロジェクト: 135yshr/slackbot
func TestSysstdBuildPluginsHelp(t *testing.T) {
	botCtx, err := slackbot.NewBotContext("hoge_token")
	if err != nil {
		t.Error(err)
	}
	botCtx.AddPlugin("echo", echo.NewPlugin())
	p := sysstd.NewPlugin(botCtx.PluginManager())

	ev := plugins.NewTestEvent("botID help")
	p.DoAction(ev, "help")
}
コード例 #5
0
ファイル: sysstd_test.go プロジェクト: 135yshr/slackbot
func TestSetTimezone(t *testing.T) {
	p := sysstd.NewPlugin(nil)
	p.SetTimezone("JST")
}
コード例 #6
0
ファイル: sysstd_test.go プロジェクト: 135yshr/slackbot
func TestSysstdDebug(t *testing.T) {
	p := sysstd.NewPlugin(nil)
	p.SetDebug(true)
}