From 62cac8ee014009086d1abe9f704ba59b8dcba9b4 Mon Sep 17 00:00:00 2001 From: Janik Kleinhoff Date: Thu, 7 Jun 2018 22:17:41 +0000 Subject: !ops: fix matching for bare !ops without message Blame krytarik, though I adjusted the suggested regex a little. Blame Unit193 for starting a fight. --- lib/ASM/Commander.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 (?nick|account|host) (?\S+) (?\+|-)(?[a-z0-9_-]+)$' => { 'flag' => 'a', 'cmd' => \&cmd_restrict }, - '^\s*\!ops(?:\s+(?#\S+))?[\s|]+(?.*)' => { + q{(?x) + ^ \s* # start of line, optional whitespace + \!ops # actual command + (?: # optionally: + \s+ # spaces + (? \# \S+ ) # channel name + )? + (?: # optionally: + [\s|]+ # spaces (or "|", used to separate reason with some bots) + (?.*?) # reason/message. Uses .*? so preceding and following + )? # \s+ / \s* will "strip" whitespace. + \s* $ # optional whitespace, end of line + } => { 'nohush' => 'nohush', 'cmd' => \&cmd_ops }, '^;blacklist (?.+)' => { -- cgit v1.2.3