nutza tv ch
nutza tv ch

Reputation: 11

I can't get a voice channel from user [Discord.js v12]

I can't get a voice channel from user with Discord.js v12.

This is what I tried:

let voicech = message.member.VoiceChannel;
console.log(voicech);
if (!voicech) {
    channel = message.channel;
    channel.send("หาช่องไม่เจอกรุณาเข้าช่องเสียง")
}

Upvotes: 0

Views: 245

Answers (1)

Skulaurun Mrusal
Skulaurun Mrusal

Reputation: 2847

According to discord.js docs. GuildMember does not have a .VoiceChannel property which you are trying to access.

What GuildMember has is a VoiceState, access that (using .voice property) and get the VoiceChannel (using .channel property) like this:

const voiceChannel = message.member.voice.channel;

Upvotes: 3

Related Questions