CheeseGroveCam
CheeseGroveCam
DIAdiscord.js - Imagine an app
Created by CheeseGroveCam on 4/13/2024 in #djs-questions
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);
}
function getActiveUsers(server) {
return server?.voiceStates?.cache.map(channel => channel?.member?.user?.username);
}
22 replies
DIAdiscord.js - Imagine an app
Created by CheeseGroveCam on 4/12/2024 in #djs-questions
Server available is false most of the time.
I get available == false about 4/5 times when doing this request.
function getServers(client) {
return client.guilds.cache;
}

const servers = getServers(client);

servers.forEach(server => {
if(!server.available) {
console.log('Server not available');
return;
}
});
function getServers(client) {
return client.guilds.cache;
}

const servers = getServers(client);

servers.forEach(server => {
if(!server.available) {
console.log('Server not available');
return;
}
});
Could this be a login issue maybe? Also worth noting, is that I'm running an older version. 12.x something. I'd rather not update if possible.
4 replies