only send if we have a resp

This commit is contained in:
Aaron Bieber 2021-04-07 20:16:01 -06:00
parent 55a587e952
commit a57627fa00

6
irc.go
View File

@ -39,6 +39,7 @@ func ircConnect(store *FStore, plugins *plugins.Plugins) error {
switch m.Command {
case "001":
for _, r := range strings.Split(ircRooms, ",") {
log.Printf("IRC: joining %q\n", r)
c.Write(fmt.Sprintf("JOIN %s", r))
}
case "PRIVMSG":
@ -66,8 +67,8 @@ func ircConnect(store *FStore, plugins *plugins.Plugins) error {
}
if resp != "" {
log.Printf("IRC: sending: %q to %q\n", resp, to)
c.WriteMessage(&irc.Message{
Command: "PRIVMSG",
Params: []string{
@ -76,6 +77,9 @@ func ircConnect(store *FStore, plugins *plugins.Plugins) error {
},
})
}
default:
log.Printf("IRC: unhandled - %q", m.String())
}
}),
}