mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-17 09:29:30 +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:
parent
2182b26bfd
commit
b58b778648
@ -26,14 +26,17 @@ sub initialize {
|
|||||||
sub execute_applet($self, $context) {
|
sub execute_applet($self, $context) {
|
||||||
if ($self->{pbot}->{registry}->get_value('general', 'debugcontext')) {
|
if ($self->{pbot}->{registry}->get_value('general', 'debugcontext')) {
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
$Data::Dumper::Sortkeys = sub { [sort grep { not /(?:cmdlist|arglist)/ } keys %$context] };
|
$Data::Dumper::Sortkeys = 1;
|
||||||
$Data::Dumper::Indent = 2;
|
$Data::Dumper::Indent = 2;
|
||||||
$self->{pbot}->{logger}->log("execute_applet\n");
|
$self->{pbot}->{logger}->log("execute_applet\n");
|
||||||
$self->{pbot}->{logger}->log(Dumper $context);
|
$self->{pbot}->{logger}->log(Dumper $context);
|
||||||
$Data::Dumper::Sortkeys = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$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) {
|
||||||
|
@ -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 => 4827,
|
BUILD_REVISION => 4828,
|
||||||
BUILD_DATE => "2024-11-02",
|
BUILD_DATE => "2024-11-03",
|
||||||
};
|
};
|
||||||
|
|
||||||
sub initialize {}
|
sub initialize {}
|
||||||
|
Loading…
Reference in New Issue
Block a user