diff options
author | Janik Kleinhoff <ilbelkyr@shalture.org> | 2018-06-07 22:17:41 +0000 |
---|---|---|
committer | Janik Kleinhoff <ilbelkyr@shalture.org> | 2018-06-07 22:17:41 +0000 |
commit | 62cac8ee014009086d1abe9f704ba59b8dcba9b4 (patch) | |
tree | 1bd1230f1ce461515d587a422bd2cbb3e03910ee | |
parent | cd280ebb1c45fe1b35ebd7d031be91c062791735 (diff) | |
download | antispammeta-62cac8ee014009086d1abe9f704ba59b8dcba9b4.tar.bz2 antispammeta-62cac8ee014009086d1abe9f704ba59b8dcba9b4.tar.xz antispammeta-62cac8ee014009086d1abe9f704ba59b8dcba9b4.tar.zst |
!ops: fix matching for bare !ops without message
Blame krytarik, though I adjusted the suggested regex a little.
Blame Unit193 for starting a fight.
-rw-r--r-- | lib/ASM/Commander.pm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/ASM/Commander.pm b/lib/ASM/Commander.pm index b4572fc..e426ed9 100644 --- a/lib/ASM/Commander.pm +++ b/lib/ASM/Commander.pm @@ -109,7 +109,19 @@ my $cmdtbl = { '^;restrict (?<type>nick|account|host) (?<who>\S+) (?<mode>\+|-)(?<restriction>[a-z0-9_-]+)$' => { 'flag' => 'a', 'cmd' => \&cmd_restrict }, - '^\s*\!ops(?:\s+(?<chan>#\S+))?[\s|]+(?<reason>.*)' => { + q{(?x) + ^ \s* # start of line, optional whitespace + \!ops # actual command + (?: # optionally: + \s+ # spaces + (?<chan> \# \S+ ) # channel name + )? + (?: # optionally: + [\s|]+ # spaces (or "|", used to separate reason with some bots) + (?<reason>.*?) # reason/message. Uses .*? so preceding and following + )? # \s+ / \s* will "strip" whitespace. + \s* $ # optional whitespace, end of line + } => { 'nohush' => 'nohush', 'cmd' => \&cmd_ops }, '^;blacklist (?<string>.+)' => { |