diff --git a/lib/PBot/Core/Factoids/Interpreter.pm b/lib/PBot/Core/Factoids/Interpreter.pm index 1de0bede..f51970e1 100644 --- a/lib/PBot/Core/Factoids/Interpreter.pm +++ b/lib/PBot/Core/Factoids/Interpreter.pm @@ -440,10 +440,10 @@ sub handle_action { my $result = $self->{pbot}->{modules}->execute_module($context); - if (length $result) { + if (defined $result && length $result) { return $ref_from . $result; } else { - return ''; + return $result; } } elsif ($self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $keyword, 'type') eq 'text') { diff --git a/lib/PBot/Core/Interpreter.pm b/lib/PBot/Core/Interpreter.pm index f221136e..5d3307b3 100644 --- a/lib/PBot/Core/Interpreter.pm +++ b/lib/PBot/Core/Interpreter.pm @@ -554,7 +554,7 @@ sub handle_result { $result //= $context->{result}; # ensure we have a command result to work with - $result //= ''; + return if not defined $result; # preservation of consecutive whitespace is disabled by default $context->{preserve_whitespace} //= 0; @@ -1000,9 +1000,8 @@ sub add_to_command_queue { $context->{'cap-override'} = $command->{'cap-override'}; } - my $result = $self->interpret($context); - $context->{result} = $result; - $self->handle_result($context, $result); + $context->{result} = $self->interpret($context); + $self->handle_result($context); }, $delay, "command $channel $command->{command}", $repeating ); diff --git a/lib/PBot/Core/Modules.pm b/lib/PBot/Core/Modules.pm index 03e3668b..989d533a 100644 --- a/lib/PBot/Core/Modules.pm +++ b/lib/PBot/Core/Modules.pm @@ -23,7 +23,6 @@ sub initialize { sub execute_module { my ($self, $context) = @_; - my $text; if ($self->{pbot}->{registry}->get_value('general', 'debugcontext')) { use Data::Dumper; diff --git a/lib/PBot/Core/ProcessManager.pm b/lib/PBot/Core/ProcessManager.pm index e7043f21..0ab7e081 100644 --- a/lib/PBot/Core/ProcessManager.pm +++ b/lib/PBot/Core/ProcessManager.pm @@ -143,8 +143,8 @@ sub execute_process { # add reader handler $self->{pbot}->{select_handler}->add_reader($reader, sub { $self->process_pipe_reader($context->{pid}, @_) }); - # return empty string since reader will handle the output when child is finished - return ''; + # return undef since reader will handle the output when child is finished + return undef; } } diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 357d298c..cfacbf8b 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,8 +25,8 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4374, - BUILD_DATE => "2021-08-28", + BUILD_REVISION => 4376, + BUILD_DATE => "2021-09-04", }; sub initialize {}