The new logbot, not committed from the wrong terminal window this time.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

34 lines
503 B

package bot
import (
"log"
"strings"
"git.aiterp.net/gisle/irc"
)
func handler(event *irc.Event, client *irc.Client) {
bot, ok := client.Value(botKey).(*Bot)
if !ok {
return
}
if event.Kind() == "packet" && len(event.Verb()) == 3 {
log.Printf("(%s) %s %s\n", event.Verb(), strings.Join(event.Args[1:], " "), event.Text)
}
switch event.Name() {
case "hook.ready":
{
go bot.loop()
}
case "client.disconnect":
{
bot.stopLoop()
}
}
}
func init() {
irc.Handle(handler)
}