I made a feature in my discord bot to react to emojis with the same emoji, but when someone sends a message that isnt an emoji, it sends this error (it doesnt stop the bot, it just annoys me and floods the console)
Here it is:
client.on("message", message => {
try {
message.react(message.content);
} catch (err) {
console.log('')
}
});
I tried looking for a way to check if the message is an emoji or not before running message.react(message.content);
.
But i didn't find a result.
And here's the error: UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Emoji
CodePudding user response:
To ignore an error you can add .catch((err) => {})
to your code, for example:
message.react("").catch((err) => {})