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
d.js toolkit
d.js toolkit6mo 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
monbrey
monbrey6mo ago
You need to fetch and populate the guild member cache first guild.members.fetch()
FoxMeDead
FoxMeDeadOP6mo ago
I was fetching the whole guild, im guessing that skips the members?
monbrey
monbrey6mo ago
Yeah it only fetches the guild data
FoxMeDead
FoxMeDeadOP6mo ago
still doesnt seem to return the members as part of the role structure
No description
monbrey
monbrey6mo ago
Its a getter, not an enumerable property All role.members does is apply a filter to guild.members and return it
FoxMeDead
FoxMeDeadOP6mo ago
it 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?
monbrey
monbrey6mo ago
You're probably missing the GuildMembers intent
FoxMeDead
FoxMeDeadOP6mo ago
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
Want results from more Discord servers?
Add your server