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

New module commands::later

parent 989b0072
Branches
Étiquettes
Aucune requête de fusion associée trouvée
package commands::later;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(exec);
sub exec {
my ($kernel, $nick, $id, $time, $unit) = @_;
$time = 6 if (!$time);
$time *= ($unit eq 's') ? 1 : ($unit eq 'm') ? 60 : 3600;
$kernel->delay_set('_later', $time, $nick, $id);
}
1;
...@@ -6,12 +6,14 @@ our @EXPORT_OK = qw(exec); ...@@ -6,12 +6,14 @@ our @EXPORT_OK = qw(exec);
use lib "$FindBin::Bin/lib/"; use lib "$FindBin::Bin/lib/";
use commands::fav; use commands::fav;
use commands::later;
#use later; #use later;
#use tag; #use tag;
#use help; #use help;
our $irc; our $irc;
our $dbh; our $dbh;
our $lastID;
sub exec { sub exec {
my ($kernel, $user, $chan, $msg) = @_; my ($kernel, $user, $chan, $msg) = @_;
...@@ -23,12 +25,10 @@ sub exec { ...@@ -23,12 +25,10 @@ sub exec {
commands::fav::exec($2) commands::fav::exec($2)
} }
elsif ($msg =~ /^!later(?: ([0-9]+))?(?: in ([0-9]*)?(h|m|s)?)?/) { elsif ($msg =~ /^!later(?: ([0-9]+))?(?: in ([0-9]*)?(h|m|s)?)?/) {
my ($id, $time, $unit) = ($1, $2, $3); my $id = ($1) ? $1 : $lastID;
my ($time, $unit) = ($2, $3);
$id = $lastID if (!$id); commands::later::exec ($id, $time, $unit);
$time = 6 if (!$time);
$time *= ($unit eq 's') ? 1 : ($unit eq 'm') ? 60 : 3600;
$kernel->delay_set('_later', $time, $nick, $id);
} }
elsif ($msg =~ /^!tag( +([0-9]+))?/) { elsif ($msg =~ /^!tag( +([0-9]+))?/) {
my $id = ($2) ? $2 : $lastID; my $id = ($2) ? $2 : $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