Wrong user count
Every time that I run the command again, the users var will increase insane, for example every second +10 members. The first where I use the command after every restart, it will give me the correct userCount. Can anyone tell me how to fix that?
9 Replies
- 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!${client.guilds.cache.map((guild) => guild.memberCount).reduce((p, c) => p + c, 0).toLocaleString()}
this is what i use
It's constant now, but it returns me 90.000+ instead of 30.000+ I think it counts the duplicated members also
Yes, member counts are for members, and a user can be a member of multiple guilds
It's still better than relying on cached users who will (and should) generally be a fraction of the total amount of unique users in servers with your bot
i'm not sure, but you can try this for unique members:
It shows me the amount of guilds 😅
one second
wait
try it
again though, you're relying on cached members, not all members
Then try with fetch, but I’m not sure that the bot will fetch a large count of servers without problems in a short period of time.