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

Applets: execute_applet() returns defined value to end interpreter loop

Due to recent changes to support continued processing of empty string command
results, ProcessManager::execute_process() now returns undefined value, which
causes Interpreter::interpret() to continue looping through registered command
interpreters after successfully handling a command.

This causes some plugins, i.e. Plugin/Date.pm, to continue the interpret() loop
after successfully handling a command, which causes additional interpreters to
handle the command, leading to both a built-in command an a factoid command
being invoked if they share the same name.

Applets::execute_applet() now returns the defined empty string to let the
interpreter loop know that the command has been handled.
This commit is contained in:
Pragmatic Software 2024-11-03 12:05:39 -08:00
parent 2182b26bfd
commit b58b778648
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
2 changed files with 7 additions and 4 deletions

View File

@ -26,14 +26,17 @@ sub initialize {
sub execute_applet($self, $context) {
if ($self->{pbot}->{registry}->get_value('general', 'debugcontext')) {
use Data::Dumper;
$Data::Dumper::Sortkeys = sub { [sort grep { not /(?:cmdlist|arglist)/ } keys %$context] };
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Indent = 2;
$self->{pbot}->{logger}->log("execute_applet\n");
$self->{pbot}->{logger}->log(Dumper $context);
$Data::Dumper::Sortkeys = 1;
}
$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) {

View File

@ -25,8 +25,8 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4827,
BUILD_DATE => "2024-11-02",
BUILD_REVISION => 4828,
BUILD_DATE => "2024-11-03",
};
sub initialize {}