'API error when someone deletes message reacted by bot Discord.JS
I'm new to the programming world and I decided to start learning JavaScript, first with Discord bots. How can I fix my bot that stops working when someone deletes or edits the message?
if (message.channel.id === 'ChannelID') {
message.react('✅')
.then(() => {
message.react('❌')
});
}
if (message.channel.id === 'ChannelID') {
message.react('⭐');
}
if (message.channel.id === 'ChannelID') {
message.react('⬆️')
.then(() => {
message.react('⬇️')
});
}
});```
Solution 1:[1]
Handle the promise rejection of Message#react()
message
.react(...)
.catch(console.error);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Elitezen |
