From 75a31458b060d841351f311bafe6f6c6755a6a53 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sun, 9 Jun 2019 21:50:40 -0700 Subject: [PATCH] FactoidCommands: factlog/factundo/factredo now work with keywords containing spaces --- PBot/FactoidCommands.pm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/PBot/FactoidCommands.pm b/PBot/FactoidCommands.pm index 603f2438..7b382ddf 100644 --- a/PBot/FactoidCommands.pm +++ b/PBot/FactoidCommands.pm @@ -346,7 +346,6 @@ sub factundo { chomp $getopt_error; }; - $arguments =~ s/(? \$list_undos, @@ -356,7 +355,7 @@ sub factundo { return $usage if @$args > 2; return $usage if not @$args; - $arguments = join ' ', @$args; + $arguments = join(' ', map { $_ = "'$_'" } @$args); my $arglist = $self->{pbot}->{interpreter}->make_args($arguments); my ($channel, $trigger) = $self->find_factoid_with_optional_channel($from, $arguments, 'factundo', explicit => 1, exact_channel => 1); @@ -447,7 +446,6 @@ sub factredo { chomp $getopt_error; }; - $arguments =~ s/(? \$list_undos, @@ -457,7 +455,7 @@ sub factredo { return $usage if @$args > 2; return $usage if not @$args; - $arguments = join ' ', @$args; + $arguments = join(' ', map { $_ = "'$_'" } @$args); my ($channel, $trigger) = $self->find_factoid_with_optional_channel($from, $arguments, 'factredo', explicit => 1, exact_channel => 1); return $channel if not defined $trigger; # if $trigger is not defined, $channel is an error message @@ -1139,7 +1137,6 @@ sub factlog { chomp $getopt_error; }; - $arguments =~ s/(? \$show_hostmask, @@ -1149,11 +1146,13 @@ sub factlog { return "Too many arguments -- $usage" if @$args > 2; return "Missing argument -- $usage" if not @$args; - my ($channel, $trigger) = $self->find_factoid_with_optional_channel($from, "@$args", 'factlog', usage => $usage, exact_channel => 1); + $args = join(' ', map { $_ = "'$_'" } @$args); + + my ($channel, $trigger) = $self->find_factoid_with_optional_channel($from, $args, 'factlog', usage => $usage, exact_channel => 1); if (not defined $trigger) { # factoid not found or some error, try to continue and load factlog file if it exists - my $arglist = $self->{pbot}->{interpreter}->make_args("@$args"); + my $arglist = $self->{pbot}->{interpreter}->make_args($args); ($channel, $trigger) = $self->{pbot}->{interpreter}->split_args($arglist, 2); if (not defined $trigger) { $trigger = $channel;