#Unable to fetch all members from role
6 messages · Page 1 of 1 (latest)
- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - Not a discord.js issue? Check out #1081585952654360687.
- 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
Here is my code:
const guildRole = await (interaction.guild as Guild).roles.fetch(teamRoleId, { force: true });
console.log(guildRole?.members)
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 !