From 2096df16d622b43a8233024f203d5a5d09f3d54b Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sun, 24 Sep 2023 11:24:20 -0700 Subject: [PATCH] Factoids: process regex factoids when implicitly invoked --- lib/PBot/Core/Factoids/Interpreter.pm | 13 +++++++------ lib/PBot/VERSION.pm | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/PBot/Core/Factoids/Interpreter.pm b/lib/PBot/Core/Factoids/Interpreter.pm index 349b452c..0e644d4a 100644 --- a/lib/PBot/Core/Factoids/Interpreter.pm +++ b/lib/PBot/Core/Factoids/Interpreter.pm @@ -112,12 +112,7 @@ sub interpreter($self, $context) { return $self->interpreter($context); } - # keyword still not found, try regex factoids if the bot was explicitly invoked - if (not $context->{addressed}) { - $self->{pbot}->{logger}->log("No factoid found; disregarding error message because bot not explicitly invoked\n"); - return ''; - } - + # keyword still not found, try regex factoids ($channel, $keyword) = $self->{pbot}->{factoids}->{data}->find( $context->{ref_from} ? $context->{ref_from} : $context->{from}, @@ -128,6 +123,12 @@ sub interpreter($self, $context) { # no such keyword, display similiar matches for all channels if (not defined $keyword) { + # but only if the bot is explicitly invoked + if (not $context->{addressed}) { + $self->{pbot}->{logger}->log("No factoid found; disregarding error message because bot not explicitly invoked\n"); + return ''; + } + my $namespace = $context->{from}; $namespace = '.*' if $namespace !~ /^#/; diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index acc8deff..8072d410 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,8 +25,8 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4687, - BUILD_DATE => "2023-09-23", + BUILD_REVISION => 4688, + BUILD_DATE => "2023-09-24", }; sub initialize {}