0
votes

I've got a discord bot running on Discord.js for a personal server and it's meant to react to certain phrases (good morning, good night, etc) with a message and a random emoji react pulled from an array.

My problem in particular is with this one: ["????", "????", "????", "⚰️", "????", "????"];

Unfortunately, the bot only seems to react with some of the specified emojis while others return a "DiscordAPIError: Unknown Emoji" error in the console.

For example, the bot will react with ???? but attempting to react with ⚰️ returns the error and the bot does not react. I've made sure to use only default unicode emojis but this still keeps happening.

EDIT:

This array is specifically for halloween themed reacts:

halreactoptions = ["????", "????", "????", "⚰️", "????", "????"];

halreactrandom = halreactoptions[Math.floor(Math.random()*halreactoptions.length)];

And then at the end of the bot's message code I have:

message.react(halreactrandom);

This works perfectly fine for my other emoji array, it seems that those Halloween themed ones are the only ones that return the unknown emoji error, and even then only specific ones. Very odd. I've written the code entirely in Atom, if that matters / helps.

1
I don't see any problem with it. Try posting us the code that is sending + the emoji array declaration.Orel Eraki
You have scream, ghost, jack_o_lantern, coffin, bat, alien, non of them are Halloween, did you means jack_o_lantern ?Orel Eraki

1 Answers

0
votes

I think this might be an issue related to the unicode emoji you have found. I have tested and tried reacting the list of emoji you have provided, and indeed only the coffin emoji (⚰️) does not seem to work while everything else works fine.

Upon closer inspection, the coffin emoji you have provided in this case is not exactly the same as the one obtained in Discord through escaping the emoji (add a \ in front of the emoji to view the unicode version, in this case \:coffin:).

The emoji you have provided is actually in its variant form with an additional variant selector (more info here and here), therefore when you try to send it, it will not be recognised.

The discord emoji (⚰) only has the following bytes: 0xEA 0x9A 0xB0, whereas your emoji (⚰️) has these bytes: 0xEA 0x9A 0xB0 0xEF 0xB8 0x8F.

This can also be seen from a simple length comparison, where the former will only have a length of 1 compared to the latter of length 2.

As such, the reaction should work if you use the shorter emoji of length 1, ⚰.