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