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

Command !fav corrections

 - new arg $nick to exec()
 - better regex
 - remove useless $irc
parent a357282e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -4,11 +4,10 @@ require Exporter; ...@@ -4,11 +4,10 @@ require Exporter;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT_OK = qw(exec); our @EXPORT_OK = qw(exec);
our $irc;
our $dbh; our $dbh;
sub exec { sub exec {
my $id = shift; my ($nick, $id) = @_;
my $sth = $dbh->prepare_cached('SELECT user FROM playbot_codes WHERE nick = ?'); my $sth = $dbh->prepare_cached('SELECT user FROM playbot_codes WHERE nick = ?');
$sth->execute($nick) $sth->execute($nick)
...@@ -23,3 +22,5 @@ sub exec { ...@@ -23,3 +22,5 @@ sub exec {
or $log->error("Couldn't finish transaction: " . $dbh->errstr); or $log->error("Couldn't finish transaction: " . $dbh->errstr);
} }
} }
1;
...@@ -19,10 +19,11 @@ sub exec { ...@@ -19,10 +19,11 @@ sub exec {
my ($kernel, $user, $chan, $msg) = @_; my ($kernel, $user, $chan, $msg) = @_;
my ($nick,$mask) = split(/!/,$user); my ($nick,$mask) = split(/!/,$user);
if ($msg =~ /^!fav( ([0-9]+))?/) { if ($msg =~ /^!fav(?: ([0-9]+))?/) {
$commands::fav::irc = $irc; $id = ($1) ? $1 : $lastID;
$commands::fav::dbh = $dbh; $commands::fav::dbh = $dbh;
commands::fav::exec($2) commands::fav::exec($nick, $id)
} }
elsif ($msg =~ /^!later(?: ([0-9]+))?(?: in ([0-9]*)?(h|m|s)?)?/) { elsif ($msg =~ /^!later(?: ([0-9]+))?(?: in ([0-9]*)?(h|m|s)?)?/) {
my $id = ($1) ? $1 : $lastID; my $id = ($1) ? $1 : $lastID;
......
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