Prevent non-commands being passed to antispam check.

master
Icedream 2018-06-03 00:47:59 +02:00
parent e72ec5f3e4
commit 3ea158f25a
Signed by: icedream
GPG Key ID: 1573F6D8EFE4D0CF
1 changed files with 5 additions and 0 deletions

View File

@ -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)))