How do i get member count of a specific guild
I want to get all the members in my specific guild but when i try to use members.memberCount it says undefined (check screenshots below) and i though maybe you guys could help
![No description](https://cdn.answeroverflow.com/1163955448051941416/Screenshot_from_2023-10-17_23-41-48.png)
![No description](https://cdn.answeroverflow.com/1163955448320364605/Screenshot_from_2023-10-17_23-41-26.png)
3 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!
- ✅
Marked as resolved by OPGetting your bot's member count
-
client.users.cache.size
is unreliable because it will only return cached users
- The preferred method is using collection.reduce()
on client.guilds.cache
My bad, sorry for posting in here😁