2016-01-17 18:00:44 +00:00
|
|
|
// © 2013 the CatBase Authors under the WTFPL. See AUTHORS for the list of authors.
|
2013-12-10 23:37:07 +00:00
|
|
|
|
2012-08-17 20:38:15 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2013-05-09 22:30:15 +00:00
|
|
|
"flag"
|
2013-06-02 01:59:55 +00:00
|
|
|
"log"
|
2014-04-20 16:54:01 +00:00
|
|
|
|
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"
|
2016-03-24 17:32:40 +00:00
|
|
|
"github.com/velour/catbase/plugins/admin"
|
2016-05-15 18:13:34 +00:00
|
|
|
"github.com/velour/catbase/plugins/babbler"
|
2016-03-24 17:32:40 +00:00
|
|
|
"github.com/velour/catbase/plugins/beers"
|
2016-04-04 14:33:32 +00:00
|
|
|
"github.com/velour/catbase/plugins/counter"
|
2016-03-24 17:32:40 +00:00
|
|
|
"github.com/velour/catbase/plugins/dice"
|
|
|
|
"github.com/velour/catbase/plugins/fact"
|
2016-03-25 16:25:00 +00:00
|
|
|
"github.com/velour/catbase/plugins/leftpad"
|
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"
|
2017-06-05 22:37:46 +00:00
|
|
|
"github.com/velour/catbase/plugins/stats"
|
2016-03-24 17:32:40 +00:00
|
|
|
"github.com/velour/catbase/plugins/talker"
|
|
|
|
"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"
|
2013-06-02 01:59:55 +00:00
|
|
|
)
|
2012-08-17 20:38:15 +00:00
|
|
|
|
2013-06-02 01:59:55 +00:00
|
|
|
func main() {
|
|
|
|
var cfile = flag.String("config", "config.json",
|
|
|
|
"Config file to load. (Defaults to config.json)")
|
2012-08-17 20:38:15 +00:00
|
|
|
flag.Parse() // parses the logging flags.
|
|
|
|
|
2016-03-10 18:37:07 +00:00
|
|
|
c := config.Readconfig(Version, *cfile)
|
|
|
|
var client bot.Connector
|
2013-06-02 01:59:55 +00:00
|
|
|
|
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)
|
2013-06-02 01:59:55 +00:00
|
|
|
}
|
|
|
|
|
2016-03-30 14:00:20 +00:00
|
|
|
b := bot.New(c, client)
|
2016-03-10 18:37:07 +00:00
|
|
|
|
|
|
|
// b.AddHandler(plugins.NewTestPlugin(b))
|
2016-03-30 14:00:20 +00:00
|
|
|
b.AddHandler("admin", admin.New(b))
|
2017-06-05 22:37:46 +00:00
|
|
|
b.AddHandler("stats", stats.New(b))
|
2016-03-11 02:11:52 +00:00
|
|
|
// b.AddHandler("first", plugins.NewFirstPlugin(b))
|
2016-03-25 16:25:00 +00:00
|
|
|
b.AddHandler("leftpad", leftpad.New(b))
|
2017-06-05 22:37:46 +00:00
|
|
|
// b.AddHandler("downtime", downtime.New(b))
|
2016-03-25 19:10:56 +00:00
|
|
|
b.AddHandler("talker", talker.New(b))
|
2016-03-30 14:00:20 +00:00
|
|
|
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))
|
2013-06-02 01:59:55 +00:00
|
|
|
// catches anything left, will always return true
|
2016-03-30 14:00:20 +00:00
|
|
|
b.AddHandler("factoid", fact.New(b))
|
2013-01-23 00:22:32 +00:00
|
|
|
|
2016-03-10 18:37:07 +00:00
|
|
|
client.Serve()
|
2012-08-17 20:38:15 +00:00
|
|
|
}
|