From 646a7f8e7f0ec310f888816576734fa3d1580e3a Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Fri, 4 Oct 2024 22:34:02 -0700 Subject: [PATCH] Factoids: move `/code` to after action processing --- lib/PBot/Core/Factoids/Interpreter.pm | 19 ++++++++++--------- lib/PBot/VERSION.pm | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/PBot/Core/Factoids/Interpreter.pm b/lib/PBot/Core/Factoids/Interpreter.pm index 0e644d4a..bbd92c44 100644 --- a/lib/PBot/Core/Factoids/Interpreter.pm +++ b/lib/PBot/Core/Factoids/Interpreter.pm @@ -257,15 +257,6 @@ sub interpreter($self, $context) { $action = $self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $keyword, 'action'); } - # action is a code factoid - if ($action =~ m{^/code\s+([^\s]+)\s+(.+)$}msi) { - my ($lang, $code) = ($1, $2); - $context->{lang} = $lang; - $context->{code} = $code; - $self->{pbot}->{factoids}->{code}->execute($context); - return ''; - } - # fork factoid if background-process is enabled if ($self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $keyword, 'background-process')) { my $timeout = $self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $keyword, 'process-timeout'); @@ -453,6 +444,16 @@ sub handle_action($self, $context, $action) { $context->{preserve_whitespace} = $preserve_whitespace; } + # action is a code factoid + if ($action =~ m{^/code\s+([^\s]+)\s+(.+)$}msi) { + my ($lang, $code) = ($1, $2); + $context->{lang} = $lang; + $context->{code} = $code; + $self->{pbot}->{factoids}->{code}->execute($context); + return ''; + } + + return $action if $context->{special} eq 'code-factoid'; if ($self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $keyword, 'type') eq 'applet') { diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index a9ca8fa9..5305c3fc 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 => 4796, - BUILD_DATE => "2024-10-02", + BUILD_REVISION => 4798, + BUILD_DATE => "2024-10-04", }; sub initialize {}