3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 22:09:26 +01:00

Fix piping from aliases containing pipes

This commit is contained in:
Pragmatic Software 2017-11-28 19:07:01 -08:00
parent e0e8434b85
commit ed5a34f16e

View File

@ -252,8 +252,6 @@ 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;
# parse out a pipe unless escaped # parse out a pipe unless escaped
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*([^}]+)\}(.*)/;
@ -265,9 +263,14 @@ sub interpret {
$stuff->{prepend} = '/say ' unless exists $self->{pipe}; $stuff->{prepend} = '/say ' unless exists $self->{pipe};
$arguments = $args; $arguments = $args;
$stuff->{pipe} = $pipe;
$stuff->{pipe_rest} = $rest; if (exists $stuff->{pipe}) {
$got_pipe = 1; $stuff->{pipe_rest} = "$rest | { $stuff->{pipe} }$stuff->{pipe_rest}";
$stuff->{pipe} = $pipe;
} else {
$stuff->{pipe} = $pipe;
$stuff->{pipe_rest} = $rest;
}
} }
# unescape any escaped pipes # unescape any escaped pipes