#Trying to detect emojis added to messages

16 messages · Page 1 of 1 (latest)

marble silo
#

I am attempting to detect when emojis are added to messages and do different things based on the emoji however currently it isn't doing anything. I found a thing mentioning doing it this way so I tried it, I also looked into event handling and tried putting it into its own file, below, and that didn't work either. Neither of them give errors they simply don't print anything.
inside of index.js:js client.on(Events.MessageReactionAdd, (reaction) => { console.log("event entered"); if (reaction.emoji.identifier == 'gold') { console.log("Reaction emoji gold!"); } else { console.log(reaction.emoji.identifier); } })events/messageReactionAdd.js:```js
const { Events, MessageFlags } = require('discord.js');

module.exports = {
name: Events.MessageReactionAdd,
async execute(reaction) {
console.log("event entered");
if (reaction.emoji.identifier == 'gold') {
console.log("Reaction emoji gold!");
} else {
console.log(reaction.emoji.identifier);
}
}
};

frosty schoonerBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
glass cliff
#

That’s not a valid format for Emoji.identifier

#

You should just check the emoji.id to the custom emoji id that ur checking for

marble silo
#

If that were the problem it would still be either printing something (even if just undefined) or giving an error, but it isn't doing either.

#

I will still make that change, but right now it isn't even entering execute or client.on(Events.MessageReactionAdd

glass cliff
#

Is the reaction occurring in a guild?

marble silo
#

Yeah, and the bot can see messages in the guild

glass cliff
#

Did you enable the guild message reactions intent?

marble silo
#

I believe so, how can I double check?

#

Nevermind, I found it, I had thought GuildMessages and MessageContent together would include it.

#

unfortunately however adding the intent doesn't fix the issue

glass cliff
#

Was the message sent before the bot became ready?

marble silo
#

Ah, yeah. That was the issue. Does there happen to be any way around that issue?

glass cliff
#

Enable the message partial

dry larkBOT
#

guide Popular Topics: Partial Structures - Enabling Partials
read more