func makeBeersPlugin(t *testing.T) (*BeersPlugin, *bot.MockBot) { mb := bot.NewMockBot() counter.New(mb) b := New(mb) assert.NotNil(t, b) return b, mb }
func makePlugin(t *testing.T) (*LeftpadPlugin, *bot.MockBot) { mb := bot.NewMockBot() counter.New(mb) p := New(mb) assert.NotNil(t, p) return p, mb }
func main() { var cfile = flag.String("config", "config.json", "Config file to load. (Defaults to config.json)") flag.Parse() // parses the logging flags. c := config.Readconfig(Version, *cfile) var client bot.Connector switch c.Type { case "irc": client = irc.New(c) case "slack": client = slack.New(c) default: log.Fatalf("Unknown connection type: %s", c.Type) } b := bot.New(c, client) // b.AddHandler(plugins.NewTestPlugin(b)) b.AddHandler("admin", admin.New(b)) // b.AddHandler("first", plugins.NewFirstPlugin(b)) b.AddHandler("leftpad", leftpad.New(b)) b.AddHandler("downtime", downtime.New(b)) b.AddHandler("talker", talker.New(b)) b.AddHandler("dice", dice.New(b)) b.AddHandler("beers", beers.New(b)) b.AddHandler("remember", fact.NewRemember(b)) b.AddHandler("your", your.New(b)) b.AddHandler("counter", counter.New(b)) b.AddHandler("reminder", reminder.New(b)) b.AddHandler("babbler", babbler.New(b)) b.AddHandler("twitch", twitch.New(b)) b.AddHandler("zork", zork.New(b)) // catches anything left, will always return true b.AddHandler("factoid", fact.New(b)) client.Serve() }