Unable to fetch all members from role
Hello.
For my app, i need to get all members of a predefined role id to fill a const
Unfortunately, when i fetch members from role, i get only me in member, other member is not present in map.
I have enabled Guild and Guild_Members intents.
4 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 OPHere is my code:
You would need to fetch all members, then access guildRole.members
Usually, you don't need to fetch the role, as it's cached on ready if you have the guilds intent. The members getter just filters the guild.members.cache collection, which is why you need to fetch them first
Okayy ty, it works !
My new code, for other people: