From efb53e397f3b9433074ac798fb60337cad84d27c Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Fri, 17 Nov 2017 21:36:41 -0800 Subject: [PATCH] `count` now does whole-word matching --- PBot/FactoidCommands.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PBot/FactoidCommands.pm b/PBot/FactoidCommands.pm index cd6bb296..03be091d 100644 --- a/PBot/FactoidCommands.pm +++ b/PBot/FactoidCommands.pm @@ -1077,8 +1077,8 @@ sub count { my $i = 0; my $total = 0; - if(not defined $arguments) { - return "Usage: count "; + if (not length $arguments) { + return "Usage: count "; } $arguments = ".*" if($arguments =~ /^factoids$/); @@ -1088,7 +1088,7 @@ sub count { foreach my $command (keys %{ $factoids->{$channel} }) { next if $factoids->{$channel}->{$command}->{type} ne 'text'; $total++; - if($factoids->{$channel}->{$command}->{owner} =~ /\Q$arguments\E/i) { + if($factoids->{$channel}->{$command}->{owner} =~ /^\Q$arguments\E$/i) { $i++; } }