guild.voiceStates.cache force update?

When trying to get all users in a voicechannel, they are still in the cache after leaving. Is it possible to get an accurate count of users in voice channels?

function getActiveUsers(server) {
    return server?.voiceStates?.cache.map(channel => channel?.member?.user?.username);
}
Was this page helpful?