mirror of
https://github.com/pragma-/pbot.git
synced 2025-05-03 21:27:31 +02: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 $index = int rand @$list;
|
||||||
my $choice = $list->[$index];
|
my $choice = $list->[$index];
|
||||||
|
|
||||||
# strip outer quotes
|
|
||||||
if (not $choice =~ s/^"(.*)"$/$1/) { $choice =~ s/^'(.*)'$/$1/; }
|
|
||||||
|
|
||||||
push @choices, $choice;
|
push @choices, $choice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# strip outer quotes
|
||||||
|
foreach my $choice (@choices) {
|
||||||
|
if (not $choice =~ s/^"(.*)"$/$1/) { $choice =~ s/^'(.*)'$/$1/; }
|
||||||
|
}
|
||||||
|
|
||||||
if ($settings{'sort+'}) {
|
if ($settings{'sort+'}) {
|
||||||
@choices = sort { $a cmp $b } @choices;
|
@choices = sort { $a cmp $b } @choices;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user