Ejemplo n.º 1
0
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.NewBot(c, client)

	// b.AddHandler(plugins.NewTestPlugin(b))
	b.AddHandler("admin", plugins.NewAdminPlugin(b))
	// b.AddHandler("first", plugins.NewFirstPlugin(b))
	b.AddHandler("downtime", plugins.NewDowntimePlugin(b))
	b.AddHandler("talker", plugins.NewTalkerPlugin(b))
	b.AddHandler("dice", plugins.NewDicePlugin(b))
	b.AddHandler("beers", plugins.NewBeersPlugin(b))
	b.AddHandler("counter", plugins.NewCounterPlugin(b))
	b.AddHandler("remember", plugins.NewRememberPlugin(b))
	b.AddHandler("skeleton", plugins.NewSkeletonPlugin(b))
	b.AddHandler("your", plugins.NewYourPlugin(b))
	// catches anything left, will always return true
	b.AddHandler("factoid", plugins.NewFactoidPlugin(b))

	client.Serve()
}
Ejemplo n.º 2
0
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()
}