Skip to content
Extraits de code Groupes Projets
Valider 9b4f2420 rédigé par Alexandre Morignot's avatar Alexandre Morignot
Parcourir les fichiers

"!get some tags" uses now the random order from sql

parent 411029ff
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -29,7 +29,9 @@ sub exec { ...@@ -29,7 +29,9 @@ sub exec {
natural join playbot_tags natural join playbot_tags
where tag in ('.$params.') where tag in ('.$params.')
group by id group by id
having count(*) >= ?'); having count(*) >= ?
order by rand()
limit 1');
$sth->execute(@tags, scalar @tags); $sth->execute(@tags, scalar @tags);
} }
else { else {
...@@ -40,19 +42,18 @@ sub exec { ...@@ -40,19 +42,18 @@ sub exec {
where pt.tag in ('.$params.') where pt.tag in ('.$params.')
and pc.chan = ? and pc.chan = ?
group by p.id group by p.id
having count(*) >= ?'); having count(*) >= ?
order by rand()
limit 1');
$sth->execute(@tags, $chan->[0], scalar @tags); $sth->execute(@tags, $chan->[0], scalar @tags);
} }
$content = $sth->fetchall_arrayref; $content = $sth->fetch;
if (!@{$content}) { if (!@{$content}) {
$irc->yield(privmsg => $chan => "Je n'ai rien dans ce registre."); $irc->yield(privmsg => $chan => "Je n'ai rien dans ce registre.");
return return
} }
else {
$content = $content->[rand @{$content}];
}
} }
else { else {
my $sth; my $sth;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter