3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-01 17:16:39 +02:00

Factoids: fix issue where pick_unique() could repeat a selection

This commit is contained in:
Pragmatic Software 2020-06-14 22:34:24 -07:00
parent f71eb269cb
commit 0b94ada897

View File

@ -622,12 +622,15 @@ sub select_item {
my $index = int rand @$list;
my $choice = $list->[$index];
# strip outer quotes
if (not $choice =~ s/^"(.*)"$/$1/) { $choice =~ s/^'(.*)'$/$1/; }
push @choices, $choice;
}
# strip outer quotes
foreach my $choice (@choices) {
if (not $choice =~ s/^"(.*)"$/$1/) { $choice =~ s/^'(.*)'$/$1/; }
}
if ($settings{'sort+'}) {
@choices = sort { $a cmp $b } @choices;
}