diff --git a/PlayBot.pl b/PlayBot.pl
index 4cf05bce38e98f1f75f9b5c9a9f169e66e0722dd..83d69da1af24b81689877829a1fb5ab15beb371e 100755
--- a/PlayBot.pl
+++ b/PlayBot.pl
@@ -32,7 +32,7 @@ my $admin = 'moise';
 my $baseurl = 'http://nightiies.iiens.net/links/';
 my @nicksToVerify;
 my @codesToVerify;
-my $lastID;
+my %lastID;
 
 my $debug = 0;
 
@@ -127,7 +127,7 @@ sub cycle
     Module::Refresh->refresh;
 
     commands::parser::setConf($irc, $dbh, $log);
-    $commands::parser::lastID = $lastID;
+    %commands::parser::lastID = %lastID;
 }
 
 
@@ -286,11 +286,11 @@ sub on_speak
 
 		        $id = $sth->fetch->[0];
 	        }
-	        $lastID = $id;
-            $commands::parser::lastID = $id;
+	        $lastID{$chan->[0]} = $id;
+            $commands::parser::lastID{$chan->[0]} = $id;
 
 	        # insertion des éventuels tags
-            commands::parser::tag($msg);
+            commands::parser::tag($msg, $chan);
 
 	        # message sur irc
 	        if (defined $content{'author'}) {
diff --git a/lib/commands/parser.pm b/lib/commands/parser.pm
index 11c3ef67726898c7b71a65f7d2f70ae539730fb1..37de252f01d4a8df0369b47d1d4cd5e80f10ee79 100644
--- a/lib/commands/parser.pm
+++ b/lib/commands/parser.pm
@@ -9,7 +9,7 @@ use commands::fav;
 use commands::later;
 use commands::tag;
 
-our $lastID;
+our %lastID;
 
 my $irc;
 
@@ -30,18 +30,18 @@ sub exec {
 	my ($nick,$mask) = split(/!/,$user);
 
     if ($msg =~ /^!fav(?: ([0-9]+))?/) {
-        $id = ($1) ? $1 : $lastID;
+        $id = ($1) ? $1 : $lastID{$chan->[0]};
 
         commands::fav::exec($nick, $id)
 	}
 	elsif ($msg =~ /^!later(?: ([0-9]+))?(?: in ([0-9]*)?(h|m|s)?)?/) {
-        my $id = ($1) ? $1 : $lastID;
+        my $id = ($1) ? $1 : $lastID{$chan->[0]};
         my ($time, $unit) = ($2, $3);
 
         commands::later::exec($kernel, $nick, $id, $time, $unit);
 	}
     elsif ($msg =~ /^!tag(?: +([0-9]+))?/) {
-        my $id = ($1) ? $1 : $lastID;
+        my $id = ($1) ? $1 : $lastID{$chan->[0]};
 
         commands::tag::exec($id, $msg);
     }
@@ -59,9 +59,9 @@ sub exec {
 }
 
 sub tag {
-    my ($msg) = @_;
+    my ($msg, $chan) = @_;
 
-    commands::tag::exec($lastID, $msg);
+    commands::tag::exec($lastID{$chan->[0]}, $msg);
 }
 
 1;