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

Applets: Add $context->{interpreted} to exit interpreter loop

This commit is contained in:
Pragmatic Software 2024-11-03 19:22:45 -08:00
parent 29f1fa0c4b
commit 1f232a9455
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
4 changed files with 5 additions and 7 deletions

View File

@ -33,10 +33,6 @@ sub execute_applet($self, $context) {
} }
$self->{pbot}->{process_manager}->execute_process($context, sub { $self->launch_applet(@_) }); $self->{pbot}->{process_manager}->execute_process($context, sub { $self->launch_applet(@_) });
# return defined empty string to tell Interpreter::interpret() that we've
# handled this command so it stops looping through registered interpreters
return '';
} }
sub launch_applet($self, $context) { sub launch_applet($self, $context) {

View File

@ -561,7 +561,7 @@ sub interpret($self, $context) {
$result = $func->{subref}->($context); $result = $func->{subref}->($context);
# exit loop if interpreter returned output # exit loop if interpreter returned output
last if defined $result; last if $context->{interpreted} || defined $result;
# reset any manipulated/overridden arguments # reset any manipulated/overridden arguments
$context->{arguments} = $context->{original_arguments}; $context->{arguments} = $context->{original_arguments};

View File

@ -89,9 +89,11 @@ sub cmd_date($self, $context) {
root_channel => $context->{from}, root_channel => $context->{from},
root_keyword => "date_applet", root_keyword => "date_applet",
keyword => "date_applet", keyword => "date_applet",
arguments => "$timezone" arguments => "$timezone",
}; };
$context->{interpreted} = 1;
$self->{pbot}->{applets}->execute_applet($newcontext); $self->{pbot}->{applets}->execute_applet($newcontext);
} }

View File

@ -25,7 +25,7 @@ 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 => 4828, BUILD_REVISION => 4830,
BUILD_DATE => "2024-11-03", BUILD_DATE => "2024-11-03",
}; };