Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to ignore this error? As in stop it from sending

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);.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

But i didn’t find a result.

And here’s the error:
UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Emoji

>Solution :

To ignore an error you can add .catch((err) => {}) to your code, for example:

message.react("").catch((err) => {})
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading