Struggling to get total member count for a role
I keep getting either undefined, or 1 (the user who started the interaction) I am guessing it has something to do with the caching but I'm not sure how to update it to include everything - Everything on latest version
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!
- ✅
Marked as resolved by OPYou need to fetch and populate the guild member cache first
guild.members.fetch()
I was fetching the whole guild, im guessing that skips the members?
Yeah it only fetches the guild data
still doesnt seem to return the members as part of the role structure
Its a getter, not an enumerable property
All
role.members
does is apply a filter to guild.members
and return itit returns me nothing when i do it like that though
or if i use it after an interaction it returns the member who used the command as the only person
@ʎǝɹquoɯ Error [GuildMembersTimeout]: Members didn't arrive in time.
is there anything I can do in regards to this?
You're probably missing the GuildMembers intent
that explains a lot
I thought Guilds and the fact that fetch with specific users was working was enough, didnt even know that intent existed lol