Creating a message based on Roles

I'm trying to create a message which is essentially a lineup of all players. I'm trying to do this task by fetching their roles from Discord Server. Problem happens when using a command that message needs to be updated due to some changes and it misses few people even though proper roles are present. const role = interaction.guild.roles.cache.find(role => role.id === teamRoleIDs[i]); const totalMembers = role.members.map(m => m.id);
2 Replies
d.js toolkit
d.js toolkit10mo 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!
duck
duck10mo ago
<Role>.members is based on your bot's currently cached members, so if you haven't received all the expected players by some other means, you'd want to fetch them first you can fetch all members in a guild with <Guild>.members.fetch()