From 888da7dda1a1a63951d6f941a8249b85d52e2b57 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Fri, 15 Nov 2024 01:15:37 -0800 Subject: [PATCH] Factoids: move `enabled` check to before `/call` --- lib/PBot/Core/Factoids/Interpreter.pm | 18 +++++++++--------- lib/PBot/VERSION.pm | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/PBot/Core/Factoids/Interpreter.pm b/lib/PBot/Core/Factoids/Interpreter.pm index bd33294f..b8863be6 100644 --- a/lib/PBot/Core/Factoids/Interpreter.pm +++ b/lib/PBot/Core/Factoids/Interpreter.pm @@ -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}, diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 4514e3ed..e46afeda 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 => 4852, - BUILD_DATE => "2024-11-14", + BUILD_REVISION => 4853, + BUILD_DATE => "2024-11-15", }; sub initialize {}