3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-23 04:19:27 +01:00

Correct 0-value factoid var expansion

This commit is contained in:
Pragmatic Software 2017-09-02 01:44:57 -07:00
parent a2cd25facd
commit 58a629eca4

View File

@ -415,10 +415,10 @@ 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 = split(/\s|(".*?")/, $change);
my @mylist;
for (my $i = 0; $i <= $#list; $i++) {
push @mylist, $list[$i] if defined $list[$i];
push @mylist, $list[$i] if defined $list[$i] and length $list[$i];
}
my $line = int(rand($#mylist + 1));
$mylist[$line] =~ s/"//g;