最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

因此,我正在使不和谐的机器人在反应中发送消息

IT培训 admin 14浏览 0评论

因此,我正在使不和谐的机器人在反应中发送消息

因此,我试图制作一个可以检测到用户何时向消息添加响应的机器人,但是我无法弄清楚如何将其组合在一起。这就是我认为的样子。

我的代码

bot.on('messageReactionAdd', (reaction) => {
  if(reaction === "⚠️")
  {
    msg.reply("Only enter if your willing to take a 100% loss!");
  }
})
回答如下:

您需要在事件中添加user参数,还需要指定要查找表情符号⚠️

bot.on('messageReactionAdd', (reaction, user) => {
  if(reaction.emoji.name === "⚠️") {
    reaction.message.channel.send(`Only enter if your willing to take a 100% loss, ${user}!`); // reaction.message.channel is the channel the the message reacted to is in
  }
})

因此,我正在使不和谐的机器人在反应中发送消息

因此,我试图制作一个可以检测到用户何时向消息添加响应的机器人,但是我无法弄清楚如何将其组合在一起。这就是我认为的样子。

我的代码

bot.on('messageReactionAdd', (reaction) => {
  if(reaction === "⚠️")
  {
    msg.reply("Only enter if your willing to take a 100% loss!");
  }
})
回答如下:

您需要在事件中添加user参数,还需要指定要查找表情符号⚠️

bot.on('messageReactionAdd', (reaction, user) => {
  if(reaction.emoji.name === "⚠️") {
    reaction.message.channel.send(`Only enter if your willing to take a 100% loss, ${user}!`); // reaction.message.channel is the channel the the message reacted to is in
  }
})
发布评论

评论列表 (0)

  1. 暂无评论