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}`);
});
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.