Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
81
rated 0 times [  87] [ 6]  / answers: 1 / hits: 5643  / 4 Years ago, thu, may 21, 2020, 12:00:00

I'm trying to move a user when they react with a watermelon emoji to my embed.



I can get their user id when I use user.id, but it doesn't work with



user.id.voice.setChannel(712142435794550894);


The error I'm getting is:



UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'setChannel' of undefined


This is the code I'm using:



const check = new MessageEmbed()
.setTitle(AFK CHECK)
.setColor(0xFF0000)
.setDescription(React with a `watermelon 🍉` PLS);

message.channel.send(check).then(sentEmbed => {
sentEmbed.react(🍉);
})

bot.on('messageReactionAdd', async(reaction, user) => {
let msg = reaction.message,
emoji = reaction.emoji;
const person = user.id;
if (emoji.name == '🍉' && user.id != 711388151960043582) {
message.channel.send(HI)
user.id.voice.setChannel(712142435794550894);
}
});


How do I move the users based on their id?


More From » node.js

 Answers
3

Looks like voice exists on GuildMember (at least as of discord.js 12), so you'll need to do:



message.guild.member(user.id).voice.setChannel(712142435794550894);

[#3741] Tuesday, May 19, 2020, 4 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alejandro

Total Points: 231
Total Questions: 102
Total Answers: 107

Location: Jordan
Member since Wed, Jun 17, 2020
4 Years ago
alejandro questions
;