Trim leading and trailing spaces in message
Anirudh Oppiliappan x@icyphox.sh
Tue, 28 Dec 2021 21:24:11 +0530
1 files changed,
5 insertions(+),
2 deletions(-)
jump to
M
main.go
→
main.go
@@ -13,8 +13,11 @@ "gopkg.in/irc.v3"
) func handleChatMessage(c *irc.Client, m *irc.Message) { + // Trim leading and trailing spaces to not trip up our + // plugins. + m.Params[1] = strings.TrimSpace(m.Params[1]) response, err := plugins.ProcessTrigger(m) - + if errors.Is(err, plugins.NoReply) { return }@@ -24,7 +27,7 @@ if errors.Is(err, plugins.IsNotice) {
err = nil cmd = "NOTICE" } - msg := irc.Message {Command: cmd} + msg := irc.Message{Command: cmd} target := m.Params[0] split := strings.Split(response, "\n")