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) }