From 1f232a94555bc68351aa59987643832481345dfd Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sun, 3 Nov 2024 19:22:45 -0800 Subject: [PATCH] Applets: Add `$context->{interpreted}` to exit interpreter loop --- lib/PBot/Core/Applets.pm | 4 ---- lib/PBot/Core/Interpreter.pm | 2 +- lib/PBot/Plugin/Date.pm | 4 +++- lib/PBot/VERSION.pm | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/PBot/Core/Applets.pm b/lib/PBot/Core/Applets.pm index 78d55698..24c273a9 100644 --- a/lib/PBot/Core/Applets.pm +++ b/lib/PBot/Core/Applets.pm @@ -33,10 +33,6 @@ sub execute_applet($self, $context) { } $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) { diff --git a/lib/PBot/Core/Interpreter.pm b/lib/PBot/Core/Interpreter.pm index 29e8ae3d..7e15f270 100644 --- a/lib/PBot/Core/Interpreter.pm +++ b/lib/PBot/Core/Interpreter.pm @@ -561,7 +561,7 @@ sub interpret($self, $context) { $result = $func->{subref}->($context); # exit loop if interpreter returned output - last if defined $result; + last if $context->{interpreted} || defined $result; # reset any manipulated/overridden arguments $context->{arguments} = $context->{original_arguments}; diff --git a/lib/PBot/Plugin/Date.pm b/lib/PBot/Plugin/Date.pm index d10d0aa0..ac73caa0 100644 --- a/lib/PBot/Plugin/Date.pm +++ b/lib/PBot/Plugin/Date.pm @@ -89,9 +89,11 @@ sub cmd_date($self, $context) { root_channel => $context->{from}, root_keyword => "date_applet", keyword => "date_applet", - arguments => "$timezone" + arguments => "$timezone", }; + $context->{interpreted} = 1; + $self->{pbot}->{applets}->execute_applet($newcontext); } diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 9e478628..877d8de1 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,7 +25,7 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4828, + BUILD_REVISION => 4830, BUILD_DATE => "2024-11-03", };