Help fetching users

I didn't know if this was a sapphire or d.js issue but this line of code im using to fetch the users just isn't returning the right amount of users with the specific role. I've tried just getting all the users then filtering them with the role and it also doesn't work correctly
const supportRoleId = interaction.options.getRole('role', true).id
const logChannelId = interaction.options.getChannel('log-channel', true).id
const guild = interaction.guild
const membersWithRole = guild.roles.cache.get(supportRoleId).members
for (const [memberId, member] of membersWithRole) {
console.log(member.user.username)
}
const supportRoleId = interaction.options.getRole('role', true).id
const logChannelId = interaction.options.getChannel('log-channel', true).id
const guild = interaction.guild
const membersWithRole = guild.roles.cache.get(supportRoleId).members
for (const [memberId, member] of membersWithRole) {
console.log(member.user.username)
}
entire code base: https://srcb.in/tK6WFLMltb
1 Reply
Lynx Gian
Lynx GianOP9mo ago
nvm resolved didn't set up intents
Want results from more Discord servers?
Add your server