From 3ea158f25a696538b815d23ced2bef5e835f000f Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Sun, 3 Jun 2018 00:47:59 +0200 Subject: [PATCH] Prevent non-commands being passed to antispam check. --- main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.go b/main.go index 8884589..b3cafc2 100644 --- a/main.go +++ b/main.go @@ -414,6 +414,11 @@ func main() { log.Printf("<%s @ %s> %s", event.Nick, target, msg) cmd := parseCommand(msg) + isCommand := !isChannel || strings.HasPrefix(cmd.Name, "!") + if !isCommand { + return + } + log.Printf("Antispam check: %s, %s", event.Source, cmd.Name) if ok, duration := antispamInstance.Check(event.Source, cmd.Name); !ok { conn.Noticef(sender, "Sorry, please try again %s.", humanize.Time(time.Now().Add(duration)))