diff --git a/lib/commands/tag.pm b/lib/commands/tag.pm index 5487b1bb361cb9fc1dfe834c396f447fa9525abb..9f4f552bdcc5196c5d36123f5f06410a7a86f713 100644 --- a/lib/commands/tag.pm +++ b/lib/commands/tag.pm @@ -34,7 +34,10 @@ sub addTag return if ($stopwords_en->{lc $tag} or $stopwords_fr->{lc $tag}); - my $sth = $dbh->prepare_cached('INSERT INTO playbot_tags (id, tag, context) VALUES (?, ?, ?)'); + my $sth = $dbh->prepare_cached('INSERT INTO playbot_tags (id, tag, context) + VALUES (?, ?, ?) + ON DUPLICATE KEY + UPDATE context = 0'); $log->error("Couldn't prepare querie; aborting") unless (defined $sth); $sth->execute($id, $tag, ($context) ? 1 : 0)