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