summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Janik Kleinhoff <ilbelkyr@shalture.org>2018-06-07 22:17:41 +0000
committerLibravatar Janik Kleinhoff <ilbelkyr@shalture.org>2018-06-07 22:17:41 +0000
commit62cac8ee014009086d1abe9f704ba59b8dcba9b4 (patch)
tree1bd1230f1ce461515d587a422bd2cbb3e03910ee
parentcd280ebb1c45fe1b35ebd7d031be91c062791735 (diff)
downloadantispammeta-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.pm14
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>.+)' => {