Skip to content
Advertisement

How do I make a reaction log?

I wan’t to make a reaction log for my server, but I keep getting undefined.

Here’s the code:

client.on("messageReactionAdd", async function (messageReaction, user, message) {
  const channel = messageReaction.channel
  let reaction = await client.channels.fetch('CHANNEL ID');
  reaction.send(`A reaction has been added to a message by ${user} nin ${channel}`);
});

Advertisement

Answer

You need to get the property channel from messageReaction.message

client.on("messageReactionAdd", async function (messageReaction, user, message) {
  const channel = messageReaction.message.channel
  let reaction = await client.channels.fetch('CHANNEL ID');
  reaction.send(`A reaction has been added to a message by ${user} nin ${channel}`);
});

Documentation on MessageReactionAdd

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement