diff --git a/PlayBot.pl b/PlayBot.pl
index 74339346b694bd84f7862663ae6e1184719eb6cd..13d5b7031ce9eeabe5ce15a5bf8eafaa41759241 100755
--- a/PlayBot.pl
+++ b/PlayBot.pl
@@ -101,18 +101,6 @@ sub flux
 }
 
 
-sub addTag
-{
-    my ($id, $tag) = @_;
-
-    my $sth = $dbh->prepare_cached('INSERT INTO playbot_tags (id, tag) VALUES (?, ?)');
-	$log->error("Couldn't prepare querie; aborting") unless (defined $sth);
-
-	$sth->execute($id, $tag)
-		or $log->error("Couldn't finish transaction: " . $dbh->errstr);
-}
-
-
 sub later
 {
 	my ($nick, $id) = @_[ARG0,ARG1];
@@ -303,17 +291,8 @@ sub on_speak
 	        $lastID = $id;
             $commands::parser::lastID = $id;
 
-
 	        # insertion des éventuels tags
-	        while ($msg =~ /#([a-zA-Z0-9_-]+)/g) {
-		        if ($debug) {
-			        $log->debug($1);
-			        next;
-		        }
-
-                addTag ($lastID, $1);
-            }
-
+            commands::parser::tag($msg);
 
 	        # message sur irc
 	        if (defined $content{'author'}) {
diff --git a/lib/commands/parser.pm b/lib/commands/parser.pm
index f1709761c25905d0969ecd4e2bba35b5653f8c2c..3a2f3bbb18222b8bf87b92442fca93f0a96c92bb 100644
--- a/lib/commands/parser.pm
+++ b/lib/commands/parser.pm
@@ -38,11 +38,10 @@ sub exec {
 
         commands::later::exec($id, $time, $unit);
 	}
-    elsif ($msg =~ /^!tag( +([0-9]+))?/) {
-        my $id = ($2) ? $2 : $lastID;
-        while ($msg =~ /#([a-zA-Z0-9_-]+)/g) {
-            addTag($id, $1);
-        }
+    elsif ($msg =~ /^!tag(?: +([0-9]+))?/) {
+        my $id = ($1) ? $1 : $lastID;
+
+        commands::tag($id, $msg);
     }
     elsif ($msg =~ /^!help/) {
 		$irc->yield(privmsg => $chan => '!fav [<id>] : enregistre la vidéo dans les favoris');
@@ -57,4 +56,10 @@ sub exec {
     return 1;
 }
 
+sub tag {
+    my ($msg) = @_;
+
+    commands::tag($lastID, $msg);
+}
+
 1;
diff --git a/lib/commands/tag.pm b/lib/commands/tag.pm
new file mode 100644
index 0000000000000000000000000000000000000000..c9ce28b5038aea2290bc8514f81089e49ef4dca2
--- /dev/null
+++ b/lib/commands/tag.pm
@@ -0,0 +1,28 @@
+package commands::later;
+
+require Exporter;
+our @ISA = qw(Exporter);
+our @EXPORT_OK = qw(exec);
+
+our $kernel;
+our $dbh;
+
+sub exec {
+    my ($id, $msg) = @_;
+    while ($msg =~ /#([a-zA-Z0-9_-]+)/g) {
+        addTag($id, $1);
+    }
+}
+
+sub addTag
+{
+    my ($id, $tag) = @_;
+
+    my $sth = $dbh->prepare_cached('INSERT INTO playbot_tags (id, tag) VALUES (?, ?)');
+	$log->error("Couldn't prepare querie; aborting") unless (defined $sth);
+
+	$sth->execute($id, $tag)
+		or $log->error("Couldn't finish transaction: " . $dbh->errstr);
+}
+
+1;