简体   繁体   English

如何制作反应日志?

[英]How do I make a reaction log?

I wan't to make a reaction log for my server, but I keep getting undefined .我不想为我的服务器制作反应日志,但我不断收到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您需要从messageReaction.message获取属性channel

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 MessageReactionAdd文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM