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

commands::get now uses utils::print

parent 36199853
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -4,6 +4,9 @@ use strict; ...@@ -4,6 +4,9 @@ use strict;
use warnings; use warnings;
use Scalar::Util qw(looks_like_number); use Scalar::Util qw(looks_like_number);
use lib "$FindBin::Bin/lib/";
use utils::print;
our $dbh; our $dbh;
our $irc; our $irc;
our $log; our $log;
...@@ -121,28 +124,27 @@ sub exec { ...@@ -121,28 +124,27 @@ sub exec {
} }
} }
$sth = $dbh->prepare("select group_concat(tag separator ' ') $sth = $dbh->prepare("select tag
from playbot_tags from playbot_tags
where id = ? where id = ?
group by id"); ");
$sth->execute($content->[0]); $sth->execute($content->[0]);
my $tags = $sth->fetch; my @tags;
while (my $data = $sth->fetch) {
if ($tags) { my $tag = $data->[0];
$tags = $tags->[0]; $tag =~ s/([a-zA-Z0-9_-]+)/#$1/;
$tags =~ s/([a-zA-Z0-9_-]+)/#$1/g; push @tags, $tag;
}
else {
$tags = "";
} }
if ($content->[1]) { my %content_h;
$irc->yield(privmsg => $chan => '['.$content->[0].'] '.$content->[2].' | '.$content->[1].' => '.$content->[3].' '.$tags) ; $content_h{'id'} = $content->[0];
} $content_h{'author'} = $content->[1];
else { $content_h{'title'} = $content->[2];
$irc->yield(privmsg => $chan => '['.$content->[0].'] '.$content->[2].' => '.$content->[3].' '.$tags) ; $content_h{'url'} = $content->[3];
} $content_h{'tags'} = \@tags;
$irc->yield(privmsg => $chan => utils::print::print(\%content_h));
# we save the get like a post # we save the get like a post
my $sth2 = $dbh->prepare_cached(' my $sth2 = $dbh->prepare_cached('
......
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