mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-20 02:49:49 +01:00
Fix minor issue with command piping; misc clean-ups
This commit is contained in:
parent
5f2d6d3b96
commit
169a4c9fc7
@ -440,10 +440,10 @@ sub handle_action {
|
|||||||
|
|
||||||
my $result = $self->{pbot}->{modules}->execute_module($context);
|
my $result = $self->{pbot}->{modules}->execute_module($context);
|
||||||
|
|
||||||
if (length $result) {
|
if (defined $result && length $result) {
|
||||||
return $ref_from . $result;
|
return $ref_from . $result;
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif ($self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $keyword, 'type') eq 'text') {
|
elsif ($self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $keyword, 'type') eq 'text') {
|
||||||
|
@ -554,7 +554,7 @@ sub handle_result {
|
|||||||
$result //= $context->{result};
|
$result //= $context->{result};
|
||||||
|
|
||||||
# ensure we have a command result to work with
|
# ensure we have a command result to work with
|
||||||
$result //= '';
|
return if not defined $result;
|
||||||
|
|
||||||
# preservation of consecutive whitespace is disabled by default
|
# preservation of consecutive whitespace is disabled by default
|
||||||
$context->{preserve_whitespace} //= 0;
|
$context->{preserve_whitespace} //= 0;
|
||||||
@ -1000,9 +1000,8 @@ sub add_to_command_queue {
|
|||||||
$context->{'cap-override'} = $command->{'cap-override'};
|
$context->{'cap-override'} = $command->{'cap-override'};
|
||||||
}
|
}
|
||||||
|
|
||||||
my $result = $self->interpret($context);
|
$context->{result} = $self->interpret($context);
|
||||||
$context->{result} = $result;
|
$self->handle_result($context);
|
||||||
$self->handle_result($context, $result);
|
|
||||||
},
|
},
|
||||||
$delay, "command $channel $command->{command}", $repeating
|
$delay, "command $channel $command->{command}", $repeating
|
||||||
);
|
);
|
||||||
|
@ -23,7 +23,6 @@ sub initialize {
|
|||||||
|
|
||||||
sub execute_module {
|
sub execute_module {
|
||||||
my ($self, $context) = @_;
|
my ($self, $context) = @_;
|
||||||
my $text;
|
|
||||||
|
|
||||||
if ($self->{pbot}->{registry}->get_value('general', 'debugcontext')) {
|
if ($self->{pbot}->{registry}->get_value('general', 'debugcontext')) {
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
|
@ -143,8 +143,8 @@ sub execute_process {
|
|||||||
# add reader handler
|
# add reader handler
|
||||||
$self->{pbot}->{select_handler}->add_reader($reader, sub { $self->process_pipe_reader($context->{pid}, @_) });
|
$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 undef since reader will handle the output when child is finished
|
||||||
return '';
|
return undef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 => 4374,
|
BUILD_REVISION => 4376,
|
||||||
BUILD_DATE => "2021-08-28",
|
BUILD_DATE => "2021-09-04",
|
||||||
};
|
};
|
||||||
|
|
||||||
sub initialize {}
|
sub initialize {}
|
||||||
|
Loading…
Reference in New Issue
Block a user