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

Fixes #18: we save last command ONLY if it's actually a command

parent 9e67b2bb
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -48,9 +48,6 @@ sub exec { ...@@ -48,9 +48,6 @@ sub exec {
if ($msg eq '!' and $command{lc $chan->[0]}) { if ($msg eq '!' and $command{lc $chan->[0]}) {
$msg = $command{lc $chan->[0]}; $msg = $command{lc $chan->[0]};
} }
else {
$command{lc $chan->[0]} = $msg;
}
if ($msg =~ /^ *!fav(?: (\S+))? *$/) { if ($msg =~ /^ *!fav(?: (\S+))? *$/) {
my $index = $1; my $index = $1;
...@@ -75,24 +72,25 @@ sub exec { ...@@ -75,24 +72,25 @@ sub exec {
elsif ($msg =~ /^( *!tag)(?:( +)(-?\d+))?/) { elsif ($msg =~ /^( *!tag)(?:( +)(-?\d+))?/) {
my $index = $3; my $index = $3;
my $id; my $id;
my $tags;
if ($3) { if ($3) {
$msg = substr $msg, (length $1) + (length $2) + (length $3); $tags = substr $msg, (length $1) + (length $2) + (length $3);
} }
else { else {
$msg = substr $msg, (length $1) + (length $2); $tags = substr $msg, (length $1) + (length $2);
} }
try { try {
$id = utils::id::get($chan->[0], $index); $id = utils::id::get($chan->[0], $index);
commands::tag::exec($id, $msg); commands::tag::exec($id, $tags);
} catch { } catch {
$irc->yield(privmsg => $chan->[0] => $insultes[rand @insultes]); $irc->yield(privmsg => $chan->[0] => $insultes[rand @insultes]);
}; };
} }
elsif ($msg =~ /^( *!get)(?: +.*)?$/) { elsif ($msg =~ /^( *!get)(?: +.*)?$/) {
$msg = substr $msg, (length $1) + 1; my $query = substr $msg, (length $1) + 1;
my @args = ($chan, $msg); my @args = ($chan, $query);
my $id = commands::get::exec(@args); my $id = commands::get::exec(@args);
if ($id) { if ($id) {
...@@ -119,6 +117,7 @@ sub exec { ...@@ -119,6 +117,7 @@ sub exec {
return 0; return 0;
} }
$command{lc $chan->[0]} = $msg;
return 1; return 1;
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment