Factoids: factoid variables can now be quoted properly

This commit is contained in:
Pragmatic Software 2019-06-02 22:34:54 -07:00
parent 8814fdfe9b
commit ff3ffea15e
1 changed files with 4 additions and 2 deletions

View File

@ -463,13 +463,15 @@ sub expand_factoid_vars {
if ($self->{factoids}->hash->{$var_chan}->{$var}->{type} eq 'text') {
my $change = $self->{factoids}->hash->{$var_chan}->{$var}->{action};
my @list = split(/\s|(".*?")/, $change);
my @list = $self->{pbot}->{interpreter}->split_line($change);
my @mylist;
for (my $i = 0; $i <= $#list; $i++) {
push @mylist, $list[$i] if defined $list[$i] and length $list[$i];
}
my $line = int(rand($#mylist + 1));
$mylist[$line] =~ s/"//g;
if (not $mylist[$line] =~ s/^"(.*)"$/$1/) {
$mylist[$line] =~ s/^'(.*)'$/$1/;
}
foreach my $mod (split /:/, $modifier) {
given ($mod) {