mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 12:32:37 +01:00
Factoids: fix issue where pick_unique() could repeat a selection
This commit is contained in:
parent
f71eb269cb
commit
0b94ada897
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user