3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-22 11:59:43 +01:00

Factoids: process regex factoids when implicitly invoked

This commit is contained in:
Pragmatic Software 2023-09-24 11:24:20 -07:00
parent 5ffde32d46
commit 2096df16d6
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
2 changed files with 9 additions and 8 deletions

View File

@ -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 !~ /^#/;

View File

@ -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 {}