From 7523fbcedecdf03cb5378ad66dc1af4e9a2ac254 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 8 Jun 2019 16:00:11 -0700 Subject: [PATCH] FactoidCommands: fix an issue where factchange could sometimes fail --- PBot/FactoidCommands.pm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/PBot/FactoidCommands.pm b/PBot/FactoidCommands.pm index 21e386a9..da57ba53 100644 --- a/PBot/FactoidCommands.pm +++ b/PBot/FactoidCommands.pm @@ -1468,18 +1468,17 @@ sub factchange { my $needs_disambig; if (defined $arguments) { - if ($arguments =~ /^([^\s]+) ([^\s]+)\s+s(.)/) { - $channel = $1; - $keyword = $2; - $delim = $3; - $needs_disambig = 0; - } elsif ($arguments =~ /^([^\s]+)\s+s(.)/) { + if ($arguments =~ /^([^\s]+)\s+s(.)/) { $keyword = $1; $delim = $2; $channel = $from; $needs_disambig = 1; + } elsif ($arguments =~ /^([^\s]+) ([^\s]+)\s+s(.)/) { + $channel = $1; + $keyword = $2; + $delim = $3; + $needs_disambig = 0; } - $delim = quotemeta $delim; if ($arguments =~ /\Q$keyword\E s$delim(.*?)$delim(.*)$delim(.*)$/) {