mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-22 20:09:43 +01:00
Factoids: process regex factoids when implicitly invoked
This commit is contained in:
parent
5ffde32d46
commit
2096df16d6
@ -112,12 +112,7 @@ sub interpreter($self, $context) {
|
|||||||
return $self->interpreter($context);
|
return $self->interpreter($context);
|
||||||
}
|
}
|
||||||
|
|
||||||
# keyword still not found, try regex factoids if the bot was explicitly invoked
|
# keyword still not found, try regex factoids
|
||||||
if (not $context->{addressed}) {
|
|
||||||
$self->{pbot}->{logger}->log("No factoid found; disregarding error message because bot not explicitly invoked\n");
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
($channel, $keyword) =
|
($channel, $keyword) =
|
||||||
$self->{pbot}->{factoids}->{data}->find(
|
$self->{pbot}->{factoids}->{data}->find(
|
||||||
$context->{ref_from} ? $context->{ref_from} : $context->{from},
|
$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
|
# no such keyword, display similiar matches for all channels
|
||||||
if (not defined $keyword) {
|
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};
|
my $namespace = $context->{from};
|
||||||
$namespace = '.*' if $namespace !~ /^#/;
|
$namespace = '.*' if $namespace !~ /^#/;
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ use PBot::Imports;
|
|||||||
# These are set by the /misc/update_version script
|
# These are set by the /misc/update_version script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 4687,
|
BUILD_REVISION => 4688,
|
||||||
BUILD_DATE => "2023-09-23",
|
BUILD_DATE => "2023-09-24",
|
||||||
};
|
};
|
||||||
|
|
||||||
sub initialize {}
|
sub initialize {}
|
||||||
|
Loading…
Reference in New Issue
Block a user