Sackbot
This is the "core" component of Sackbot that makes it slightly simpler to write
plugins/sub-bots (TODO: terminology...)
The ideal way to use this is (very roughly) like this:
package main
import (
"log"
"github.com/ergochat/irc-go/ircmsg"
bot "git.actionsack.com/xnaas/sackbot-core"
)
func registerPlugin(irc *bot.Bot) {
irc.AddCallback("PRIVMSG", func(e irmsg.Message) {
target, msg := e.Params[0], e.Params[1]
if msg == "test" {
irc.Privmsg(target, "Test successful!")
}
})
log.Println("PluginName loaded.")
}
func main() {
irc := bot.MkBot("OwnerNick", false, "v0.0.1")
registerPlugin(irc)
err := irc.Connect()
if err != nil {
log.Fatal(err)
}
irc.Loop()
}