mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-23 12:29:27 +01:00
Correct 0-value factoid var expansion
This commit is contained in:
parent
a2cd25facd
commit
58a629eca4
@ -415,10 +415,10 @@ sub expand_factoid_vars {
|
|||||||
|
|
||||||
if ($self->{factoids}->hash->{$var_chan}->{$var}->{type} eq 'text') {
|
if ($self->{factoids}->hash->{$var_chan}->{$var}->{type} eq 'text') {
|
||||||
my $change = $self->{factoids}->hash->{$var_chan}->{$var}->{action};
|
my $change = $self->{factoids}->hash->{$var_chan}->{$var}->{action};
|
||||||
my @list = split(/\s+|(".*?")/, $change);
|
my @list = split(/\s|(".*?")/, $change);
|
||||||
my @mylist;
|
my @mylist;
|
||||||
for (my $i = 0; $i <= $#list; $i++) {
|
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));
|
my $line = int(rand($#mylist + 1));
|
||||||
$mylist[$line] =~ s/"//g;
|
$mylist[$line] =~ s/"//g;
|
||||||
|
Loading…
Reference in New Issue
Block a user