If someone leaving server without leaving voice channel, and we trying to get list of users in this voice channel, discord.js not removing him from list.
Code:
const members = voiceChannel.members;
// For example member A and B in voice channel.
// Member A leaving server without leaving voice channel before it
console.log(members); // Logging what member A and B still in voice channel
How I'm fixing it:
// To fix it, just need to sort it
let members = voiceChannel.members;
// Filtering users by containing in guild members
members = members.filter(member => message.guild.members.has(member.id));
// And if member A leave like before, we'll don't have this problem
console.log(members); //Logging what member B still in voice channel
Further details:
The above commit should fix the issue, please test it!
Tested it with creating simple bot, with simple command.
Joined with friend in voice, writing test, bot replying this:

Friend leaved from server without leaving voice and bot replying this:

Friend joined again and bot replying this:

@amishshah Thanks for fixing this problem ヾ(^∇^)
Most helpful comment
Tested it with creating simple bot, with simple command.
Joined with friend in voice, writing

test, bot replying this:Friend leaved from server without leaving voice and bot replying this:

Friend joined again and bot replying this:

@amishshah Thanks for fixing this problem ヾ(^∇^)