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