3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-24 11:42:35 +01:00

Fix dead argument in pipe

This commit is contained in:
Pragmatic Software 2017-11-19 14:39:03 -08:00
parent 4d99f1655c
commit fc6e0759d3

View File

@ -249,6 +249,8 @@ sub interpret {
$self->{pbot}->{logger}->log("Truncating keyword to 30 chars: $keyword\n"); $self->{pbot}->{logger}->log("Truncating keyword to 30 chars: $keyword\n");
} }
my $got_pipe = 0;
if (defined $arguments && $arguments =~ m/\|\s*\{\s*[^}]+\}\s*$/) { if (defined $arguments && $arguments =~ m/\|\s*\{\s*[^}]+\}\s*$/) {
$arguments =~ m/(.*?)\s*\|\s*\{\s*([^}]+)\}(.*)/; $arguments =~ m/(.*?)\s*\|\s*\{\s*([^}]+)\}(.*)/;
my ($args, $pipe, $rest) = ($1, $2, $3); my ($args, $pipe, $rest) = ($1, $2, $3);
@ -259,6 +261,7 @@ sub interpret {
$stuff->{arguments} = $args; $stuff->{arguments} = $args;
$stuff->{pipe} = $pipe; $stuff->{pipe} = $pipe;
$stuff->{pipe_rest} = $rest; $stuff->{pipe_rest} = $rest;
$got_pipe = 1;
} }
$stuff->{nickoverride} = $stuff->{nick} if defined $stuff->{nickoverride} and $stuff->{nickoverride} eq 'me'; $stuff->{nickoverride} = $stuff->{nick} if defined $stuff->{nickoverride} and $stuff->{nickoverride} eq 'me';
@ -295,7 +298,7 @@ sub interpret {
$stuff->{root_keyword} = $keyword; $stuff->{root_keyword} = $keyword;
} }
$stuff->{arguments} = $arguments unless exists $stuff->{pipe}; $stuff->{arguments} = $arguments unless $got_pipe;
return $self->SUPER::execute_all($stuff); return $self->SUPER::execute_all($stuff);
} }