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

a !get stores the content in the history like a post

parent 84c95ae5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -10,9 +10,10 @@ use Scalar::Util qw(looks_like_number); ...@@ -10,9 +10,10 @@ use Scalar::Util qw(looks_like_number);
our $dbh; our $dbh;
our $irc; our $irc;
our $log;
sub exec { sub exec {
my ($kernel, $user, $chan, $msg) = @_; my ($kernel, $nick, $chan, $msg) = @_;
# if we are in a query or arg -all, we search in all the channels # if we are in a query or arg -all, we search in all the channels
my $all = 0; my $all = 0;
...@@ -141,6 +142,15 @@ sub exec { ...@@ -141,6 +142,15 @@ sub exec {
$irc->yield(privmsg => $chan => '['.$content->[0].'] '.$content->[2].' => '.$content->[3].' '.$tags) ; $irc->yield(privmsg => $chan => '['.$content->[0].'] '.$content->[2].' => '.$content->[3].' '.$tags) ;
} }
# we save the get like a post
my $sth2 = $dbh->prepare_cached('
INSERT INTO playbot_chan (content, chan, sender_irc)
VALUES (?,?,?)');
$log->error("Couldn't prepare querie; aborting") unless (defined $sth2);
$sth2->execute($content->[0], $chan->[0], $nick)
or $log->error("Couldn't finish transaction: " . $dbh->errstr);
return $content->[0]; return $content->[0];
} }
......
...@@ -25,6 +25,7 @@ sub setConf { ...@@ -25,6 +25,7 @@ sub setConf {
$commands::fav::log = $log; $commands::fav::log = $log;
$commands::tag::log = $log; $commands::tag::log = $log;
$commands::get::log = $log;
$commands::later::log = $log; $commands::later::log = $log;
$commands::fav::irc = $ircNew; $commands::fav::irc = $ircNew;
...@@ -64,7 +65,7 @@ sub exec { ...@@ -64,7 +65,7 @@ sub exec {
} }
elsif ($msg =~ /^( *!get)(?: +.*)?$/) { elsif ($msg =~ /^( *!get)(?: +.*)?$/) {
$msg = substr $msg, (length $1) + 1; $msg = substr $msg, (length $1) + 1;
my @args = ($kernel, $user, $chan, $msg); my @args = ($kernel, $nick, $chan, $msg);
my $id = commands::get::exec(@args); my $id = commands::get::exec(@args);
if ($id) { if ($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