如何检查这样的人是否对消息做出了反应,并将该用户移动到另一个不和谐的语音频道.js?



如何检查这样的人是否对消息做出了反应,并将这个人移动到另一个不和谐的语音频道.js?

例如:

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

您可以使用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);
});

最新更新