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

!get work with an ID

parent 175a892f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -6,6 +6,7 @@ our @EXPORT_OK = qw(exec);
use strict;
use warnings;
use Scalar::Util qw(looks_like_number);
our $dbh;
our $irc;
......@@ -19,10 +20,17 @@ sub exec {
my @tags = ($msg =~ /#?([a-zA-Z0-9_-]+)/g);
my $content;
my $sth;
if (@tags) {
if (looks_like_number($tags[0])) {
$sth = $dbh->prepare('select id, sender, title, url
from playbot
where id = ?');
$sth->execute($tags[0]);
}
else {
my $params = join ', ' => ('?') x @tags;
my $sth;
if ($all) {
$sth = $dbh->prepare('select id, sender, title, url
......@@ -48,6 +56,7 @@ sub exec {
limit 1');
$sth->execute(@tags, $chan->[0], scalar @tags);
}
}
$content = $sth->fetch;
......@@ -57,8 +66,6 @@ sub exec {
}
}
else {
my $sth;
if ($all) {
$sth = $dbh->prepare('select id, sender, title, url from playbot
order by rand()
......@@ -83,7 +90,7 @@ sub exec {
}
}
my $sth = $dbh->prepare("select group_concat(tag separator ' ')
$sth = $dbh->prepare("select group_concat(tag separator ' ')
from playbot_tags
where id = ? and context = 0
group by id");
......
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