Browse Source

bot: Added logging of more numerics wrt. nick and added logging of direct messages.

master 0.1.1
Gisle Aune 6 years ago
parent
commit
d109349657
  1. 16
      internal/bot/handler.go

16
internal/bot/handler.go

@ -56,6 +56,12 @@ func handler(event *irc.Event, client *irc.Client) {
channel := event.ChannelTarget() channel := event.ChannelTarget()
if channel == nil { if channel == nil {
if event.Verb() == "action" {
log.Printf("Message: * %s %s", event.Nick, event.Text)
} else {
log.Printf("Message: <%s> %s", event.Nick, event.Text)
}
break break
} }
@ -86,12 +92,18 @@ func handler(event *irc.Event, client *irc.Client) {
bot.handlePost(channel.Name(), post) bot.handlePost(channel.Name(), post)
} }
// Log initial numerics for debugging's sake
// Log notices
case "packet.notice":
{
log.Printf("Message: -%s- %s", event.Nick, event.Text)
}
// Log initial numerics for debugging
case "packet.001", "packet.002", "packet.003", "packet.251", "packet.255", "packet.265", "packet.266", "packet.250", "packet.375", "packet.372", "packet.376": case "packet.001", "packet.002", "packet.003", "packet.251", "packet.255", "packet.265", "packet.266", "packet.250", "packet.375", "packet.372", "packet.376":
{ {
log.Printf("(%s) %s\n", event.Verb(), event.Text) log.Printf("(%s) %s\n", event.Verb(), event.Text)
} }
case "packet.005", "packet.254":
case "packet.005", "packet.254", "packet.cap", "packet.431", "packet.432", "packet.433", "packet.436":
{ {
log.Printf("(%s) %s %s\n", event.Verb(), strings.Join(event.Args, " "), event.Text) log.Printf("(%s) %s %s\n", event.Verb(), strings.Join(event.Args, " "), event.Text)
} }

Loading…
Cancel
Save