3
0
mirror of https://github.com/pragma-/pbot.git synced 2025-01-11 12:32:37 +01:00

Pipes can now be escaped for easy factadding, etc

This commit is contained in:
Pragmatic Software 2017-11-25 20:01:34 -08:00
parent 78a12b3a46
commit 1222436616

View File

@ -252,8 +252,9 @@ sub interpret {
my $got_pipe = 0;
if (defined $arguments && $arguments =~ m/\|\s*\{\s*[^}]+\}\s*$/) {
$arguments =~ m/(.*?)\s*\|\s*\{\s*([^}]+)\}(.*)/;
# parse out a pipe unless escaped
if (defined $arguments && $arguments =~ m/(?<!\\)\|\s*\{\s*[^}]+\}\s*$/) {
$arguments =~ m/(.*?)\s*(?<!\\)\|\s*\{\s*([^}]+)\}(.*)/;
my ($args, $pipe, $rest) = ($1, $2, $3);
$pipe =~ s/\s+$//;
@ -267,6 +268,9 @@ sub interpret {
$got_pipe = 1;
}
# unescape any escaped pipes
$arguments =~ s/\\\|\s*\{/| {/g if defined $arguments;
$stuff->{nickoverride} = $stuff->{nick} if defined $stuff->{nickoverride} and lc $stuff->{nickoverride} eq 'me';
if ((not exists $stuff->{pipe}) and $keyword !~ /^(?:factrem|forget|set|factdel|factadd|add|factfind|find|factshow|show|forget|factdel|factset|factchange|change|msg|tell|cc|eval|u|udict|ud|actiontrigger|urban|perl)$/) {