discord.js: MessageReaction.remove() gives a Bad Request Error
I am trying to remove reactions that people set on their own messages, but consistently get a bad request error. I assume this is something that might be updated on the discord API end that hasn’t been updated here yet, or that it might have been overlooked as one of the less used functions of the API.
(Or I’m failing to send proper data despite my best attempts at doing so)
Here’s a simplified code snippet that trigger the issue:
client.on("messageReactionAdd", (reaction, user) =>
{
reaction.remove(user).then(reaction =>
{
console.log('Removed a reaction.');
}, error =>
{
console.log('Unexpected error: ' + error);
});
}```
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 17 (1 by maintainers)
It could very well be something wrong in my code, I’m by no means and expert in this regard. That said, this seems simple enough that I’d be surprised if the issue really was on my end. Here’s the code without alterations on my end:
Which ends up printing this to the console:
Failed to remove a reaction that TinyHeart had put on their own message: Error: Bad RequestI’ve just tried it with my testing bot, using this code:
and it worked flawlessly.
The Commando bot on the Discord.js server also uses this event, so i’m rather sure it’s an error in your code or permissions on the server you are testing it on.
https://github.com/WeebDev/Commando/blob/master/Commando.js#L104