3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-17 01:19:31 +01:00

Factoids: move /code to after action processing

This commit is contained in:
Pragmatic Software 2024-10-04 22:34:02 -07:00
parent 3a63448753
commit 646a7f8e7f
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
2 changed files with 12 additions and 11 deletions

View File

@ -257,15 +257,6 @@ sub interpreter($self, $context) {
$action = $self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $keyword, 'action'); $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 # fork factoid if background-process is enabled
if ($self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $keyword, 'background-process')) { 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'); 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; $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'; return $action if $context->{special} eq 'code-factoid';
if ($self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $keyword, 'type') eq 'applet') { if ($self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $keyword, 'type') eq 'applet') {

View File

@ -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 => 4796, BUILD_REVISION => 4798,
BUILD_DATE => "2024-10-02", BUILD_DATE => "2024-10-04",
}; };
sub initialize {} sub initialize {}