catbase/main.go

80 lines
2.4 KiB
Go
Raw Normal View History

2016-01-17 18:00:44 +00:00
// © 2013 the CatBase Authors under the WTFPL. See AUTHORS for the list of authors.
package main
import (
"flag"
"log"
2016-01-17 18:00:44 +00:00
"github.com/velour/catbase/bot"
"github.com/velour/catbase/config"
2016-03-10 18:37:07 +00:00
"github.com/velour/catbase/irc"
"github.com/velour/catbase/plugins/admin"
2016-05-15 18:13:34 +00:00
"github.com/velour/catbase/plugins/babbler"
"github.com/velour/catbase/plugins/beers"
2016-04-04 14:33:32 +00:00
"github.com/velour/catbase/plugins/counter"
"github.com/velour/catbase/plugins/dice"
"github.com/velour/catbase/plugins/emojifyme"
"github.com/velour/catbase/plugins/fact"
2017-08-18 09:59:46 +00:00
"github.com/velour/catbase/plugins/first"
2017-09-29 04:58:21 +00:00
"github.com/velour/catbase/plugins/inventory"
2016-03-25 16:25:00 +00:00
"github.com/velour/catbase/plugins/leftpad"
"github.com/velour/catbase/plugins/reaction"
2016-05-09 17:09:17 +00:00
"github.com/velour/catbase/plugins/reminder"
2017-05-10 19:15:24 +00:00
"github.com/velour/catbase/plugins/rss"
"github.com/velour/catbase/plugins/stats"
"github.com/velour/catbase/plugins/talker"
"github.com/velour/catbase/plugins/twitch"
"github.com/velour/catbase/plugins/your"
2016-05-15 18:13:34 +00:00
"github.com/velour/catbase/plugins/zork"
2016-03-11 02:11:52 +00:00
"github.com/velour/catbase/slack"
)
func main() {
var cfile = flag.String("config", "config.lua",
"Config file to load. (Defaults to config.lua)")
flag.Parse() // parses the logging flags.
2016-03-10 18:37:07 +00:00
c := config.Readconfig(Version, *cfile)
var client bot.Connector
2016-03-10 18:37:07 +00:00
switch c.Type {
case "irc":
client = irc.New(c)
2016-03-11 02:11:52 +00:00
case "slack":
client = slack.New(c)
2016-03-10 18:37:07 +00:00
default:
log.Fatalf("Unknown connection type: %s", c.Type)
}
b := bot.New(c, client)
2016-03-10 18:37:07 +00:00
// b.AddHandler(plugins.NewTestPlugin(b))
b.AddHandler("admin", admin.New(b))
b.AddHandler("stats", stats.New(b))
2017-08-18 09:59:46 +00:00
b.AddHandler("first", first.New(b))
2016-03-25 16:25:00 +00:00
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))
2016-04-04 14:33:32 +00:00
b.AddHandler("counter", counter.New(b))
2016-05-09 17:09:17 +00:00
b.AddHandler("reminder", reminder.New(b))
2016-05-09 20:45:02 +00:00
b.AddHandler("babbler", babbler.New(b))
2016-05-15 18:13:34 +00:00
b.AddHandler("zork", zork.New(b))
2017-05-10 19:15:24 +00:00
b.AddHandler("rss", rss.New(b))
b.AddHandler("reaction", reaction.New(b))
b.AddHandler("emojifyme", emojifyme.New(b))
b.AddHandler("twitch", twitch.New(b))
2017-09-29 04:58:21 +00:00
b.AddHandler("inventory", inventory.New(b))
// catches anything left, will always return true
b.AddHandler("factoid", fact.New(b))
for {
err := client.Serve()
log.Println(err)
}
}