Get all users in voice channels with discord.js


I’m trying to get the list of users in voice channel :

client.on("messageCreate", message => {
if ( return false;

if (message.content.toLowerCase() == "test") { console.log( message.guild.members.cache.filter(member => member.presence == "online"));


I’m note sure if guild.members.cache is the right way.

I’m using discord.js 13.7.0

Any idea ?

The purpose, after I get the list users, the bot will split them randomly into two channel.


message.guild.members.cache.filter(member =>

VoiceState#channel is the voice (or stage) channel that a user is connected to. If they are not connected to a VC, this property is null.

Answered By – cherryblossom

Answer Checked By – Mary Flores (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.