Role Stats

client.on('guildMemberAdd', () => { updateVoiceChannels(); }); client.on('guildMemberRemove', () => { updateVoiceChannels(); }); async function updateVoiceChannels() { console.log("Inizio aggiornamento canali vocali..."); const guild = client.guilds.cache.get(config.guildID); if (!guild) { console.error("Impossibile trovare il server Discord."); return; } const roleChannel = guild.channels.cache.get(config.roleChannelID); const vipChannel = guild.channels.cache.get(config.vipChannelID); const staffChannel = guild.channels.cache.get(config.staffChannelID); if (!roleChannel | | !vipChannel | | !staffChannel) { console.error("Impossibile trovare tutti e tre i canali vocali."); return; } console.log("Trovati tutti i canali vocali."); const roleMembers = guild.roles.cache.get(config.roleID).members.size; const vipMembers = guild.roles.cache.get(config.vipRoleID).members.size; const staffMembers = guild.roles.cache.get(config.staffRoleID).members.size; console.log(Membri con ruolo: ${roleMembers}); console.log(Membri VIP: ${vipMembers}); console.log(Membri staff: ${staffMembers}); // Aggiorna tutti e tre i canali vocali await roleChannel.setName(🧍┇Utenti: ${roleMembers}); await vipChannel.setName(⭐┇Vip: ${vipMembers}); await staffChannel.setName(🚧┇Staff: ${staffMembers}); console.log("Aggiornamento completato."); } // Esegui l'aggiornamento dei canali vocali ogni minuto client.on("ready", () => { setInterval(() => { updateVoiceChannels(); }, 60000); }); --------- Can someone explain to me why it only counts the people who are connected to a voice chat and not the people who are on the server? also how do I tell the bot that it should only count real people and not bots in "Utenti"
3 Replies
d.js toolkit
d.js toolkit7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
thaferra
thaferraOP7mo ago
.
d.js docs
d.js docs7mo ago
Ratelimits are dynamically assigned by the API based on current load and may change at any point. - The scale from okay to API-spam is sliding and depends heavily on the action you are taking - Rainbow roles, clock and counter channels, and DM'ing advertisements to all members are all examples of things that are not okay
Want results from more Discord servers?
Add your server