如何检查这样的人是否对消息作出反应,并将该用户转移到discord.js中的另一个语音通道?

时间:2019-10-05 02:49:18

标签: javascript node.js discord discord.js

我如何检查这样的人是否对消息做出反应并将其转移到discord.js中的另一个语音通道?

例如:

if(idpeoplereact !== "idbot"){
  if(idpeoplereact.react === "✅"){ 
    member.setVoiceChannel(`${idchannel}`);
  }
}

1 个答案:

答案 0 :(得分:0)

您可以使用messageReactionAdd事件。例如:

let channelID = "29383093093983"; // The Channel ID where the member will be moved

client.on("messageReactionAdd", (reaction, user) => { // When a reaction is added
    if(user.bot) return; // If the user who reacted is a bot, return
    if(reaction.emoji.name !== "✅") return; // If the emoji is not a ✅, return
    let member = reaction.message.guild.members.get(user.id); // Fetch the guild member who added the reaction
    member.setVoiceChannel(reaction.message.guild.channels.get(channelID);
});