Как проверить, отреагировал ли такой человек на сообщение, и переместить этого пользователя в другой голосовой канал в discord.js? - PullRequest
0 голосов
/ 05 октября 2019

Как я могу проверить, отреагировал ли такой человек на сообщение, и переместить его в другой голосовой канал в discord.js?

Например:

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

1 Ответ

0 голосов
/ 01 ноября 2019

Вы можете использовать событие 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);
});
...