From 9fa3b865e91204ee81d0d64e293dbaa34fb3d863 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Wed, 30 Jun 2010 04:58:22 +0000 Subject: [PATCH] Factoids now ignore arguments that do not look like a nick if the factoid doesn't take an argument -- fixes factoid triggers on sentences with bot's name; find_factoid searches global channel if $from is not a channel --- PBot/Factoids.pm | 6 ++---- PBot/VERSION.pm | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index 98155ad6..a196ed71 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -158,7 +158,7 @@ sub export_factoids { sub find_factoid { my ($self, $from, $keyword, $arguments, $exact_channel, $exact_trigger) = @_; - $from = '.*' if not defined $from; + $from = '.*' if not defined $from or $from !~ /^#/; my $string = "$keyword" . (defined $arguments ? " $arguments" : ""); @@ -296,9 +296,7 @@ sub interpreter { $result =~ s/^/\/say $arguments: $keyword is / unless (defined $tonick); } } else { - if($result !~ /^\/.+? /) { - $result =~ s/^/\/say $keyword is / unless (defined $tonick); - } + return undef; } } } else { diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 8c3ea136..7db0a0f6 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 => 219, + BUILD_REVISION => 220, BUILD_DATE => "2010-06-29", };