Member count help

I have the following code but I want it to exclude bots, any hep would be appreciated. Thanks! client.on('ready' , (c) => { let memberCount = 0; client.guilds.cache.forEach(g => { memberCount = memberCount + g.memberCount; }); client.user.setActivity({ name: memberCount + " Members", type: ActivityType.Watching }); });
5 Replies
d.js toolkit
d.js toolkit11mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Squid
Squid11mo ago
You would have to fetch all members for each guild, filter that collection to exclude bots, and add that collection's size to your memberCount number Spoiler alert: it's not worth the trouble and it's not as cool as anyone thinks it is
unchill
unchill11mo ago
So just dont do it?
Squid
Squid11mo ago
That's my personal opinion, yes
unchill
unchill11mo ago
Alright thanks. I am very new anyways so