From a57627fa000f9586381a4d46aff9707e02ba9dae Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Wed, 7 Apr 2021 20:16:01 -0600 Subject: [PATCH] only send if we have a resp --- irc.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/irc.go b/irc.go index 0e74fc6..81b87ca 100644 --- a/irc.go +++ b/irc.go @@ -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,15 +67,18 @@ func ircConnect(store *FStore, plugins *plugins.Plugins) error { } - log.Printf("IRC: sending: %q to %q\n", resp, to) - - c.WriteMessage(&irc.Message{ - Command: "PRIVMSG", - Params: []string{ - to, - resp, - }, - }) + if resp != "" { + log.Printf("IRC: sending: %q to %q\n", resp, to) + c.WriteMessage(&irc.Message{ + Command: "PRIVMSG", + Params: []string{ + to, + resp, + }, + }) + } + default: + log.Printf("IRC: unhandled - %q", m.String()) } }), }