3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-22 18:52:40 +01:00

Factoids: move enabled check to before /call

This commit is contained in:
Pragmatic Software 2024-11-15 01:15:37 -08:00
parent c6433a662f
commit 888da7dda1
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
2 changed files with 11 additions and 11 deletions

View File

@ -379,6 +379,15 @@ sub handle_action($self, $context, $action) {
$context->{nickprefix_disabled} = 0;
}
$self->{pbot}->{logger}->log("$context->{from}: $context->{nick}!$context->{user}\@$context->{host}: $trigger_name: action: \"$action\"\n");
my $enabled = $self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $keyword, 'enabled');
if (defined $enabled and $enabled == 0) {
$self->{pbot}->{logger}->log("$trigger_name disabled.\n");
return "${ref_from}$trigger_name is disabled.";
}
# Check if it's an alias
if ($action =~ /^\/call\s+(.*)$/msi) {
my $command = $1;
@ -411,15 +420,6 @@ sub handle_action($self, $context, $action) {
return $self->{pbot}->{interpreter}->interpret($context);
}
$self->{pbot}->{logger}->log("$context->{from}: $context->{nick}!$context->{user}\@$context->{host}: $trigger_name: action: \"$action\"\n");
my $enabled = $self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $keyword, 'enabled');
if (defined $enabled and $enabled == 0) {
$self->{pbot}->{logger}->log("$trigger_name disabled.\n");
return "/msg $context->{nick} ${ref_from}$trigger_name is disabled.";
}
if ($context->{interpolate}) {
my ($root_channel, $root_keyword) = $self->{pbot}->{factoids}->{data}->find(
$context->{ref_from} ? $context->{ref_from} : $context->{from},

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 => 4852,
BUILD_DATE => "2024-11-14",
BUILD_REVISION => 4853,
BUILD_DATE => "2024-11-15",
};
sub initialize {}