diff --git a/lib/commands/parser.pm b/lib/commands/parser.pm index 341cd1b21b8fdba4a617461faa0bb3aa25978a5f..0d3638c6146716936c71124a935ab8e2d539fbb9 100644 --- a/lib/commands/parser.pm +++ b/lib/commands/parser.pm @@ -48,9 +48,6 @@ sub exec { if ($msg eq '!' and $command{lc $chan->[0]}) { $msg = $command{lc $chan->[0]}; } - else { - $command{lc $chan->[0]} = $msg; - } if ($msg =~ /^ *!fav(?: (\S+))? *$/) { my $index = $1; @@ -75,24 +72,25 @@ sub exec { elsif ($msg =~ /^( *!tag)(?:( +)(-?\d+))?/) { my $index = $3; my $id; + my $tags; if ($3) { - $msg = substr $msg, (length $1) + (length $2) + (length $3); + $tags = substr $msg, (length $1) + (length $2) + (length $3); } else { - $msg = substr $msg, (length $1) + (length $2); + $tags = substr $msg, (length $1) + (length $2); } try { $id = utils::id::get($chan->[0], $index); - commands::tag::exec($id, $msg); + commands::tag::exec($id, $tags); } catch { $irc->yield(privmsg => $chan->[0] => $insultes[rand @insultes]); }; } elsif ($msg =~ /^( *!get)(?: +.*)?$/) { - $msg = substr $msg, (length $1) + 1; - my @args = ($chan, $msg); + my $query = substr $msg, (length $1) + 1; + my @args = ($chan, $query); my $id = commands::get::exec(@args); if ($id) { @@ -119,6 +117,7 @@ sub exec { return 0; } + $command{lc $chan->[0]} = $msg; return 1; }