diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index b6eb4119..ec6b31ed 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -236,6 +236,9 @@ sub interpreter { return $ref_from . $pbot->factoids->interpreter($fwd_chan, $nick, $user, $host, $count, $fwd_trig, $arguments, undef, "[$fwd_chan] "); } else { + # if a non-nick argument was supplied, e.g., a sentence using the bot's nick, don't say anything + return "" if $arguments !~ /^[^.+-, ]{1,20}$/; + # if keyword hasn't been found, display similiar matches for all channels my $matches = $self->factoids->levenshtein_matches('.*', lc $original_keyword); @@ -337,7 +340,7 @@ sub interpreter { if(not $result =~ s/\$args/$arguments/gi) { # factoid doesn't take an argument, so assume argument is a nick if it is a single-word 20 characters or less # TODO - maintain list of channel nicks and compare against this list to ensure nick exists - if($arguments =~ /^[^ ]{1,20}$/) { + if($arguments =~ /^[^.+-, ]{1,20}$/) { # might be a nick if($result =~ /^\/.+? /) { $result =~ s/^(\/.+?) /$1 $arguments: /; @@ -345,7 +348,7 @@ sub interpreter { $result =~ s/^/\/say $arguments: $keyword is / unless defined $tonick; } } else { - # return undef; + # return ""; } } } else { diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 72044a3b..f4a82dba 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,7 +13,7 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 280, + BUILD_REVISION => 281, BUILD_DATE => "2011-01-29", };