How can I check user roles
So I have a slash command where the member has to mention a user in the command option, how can I get the roles from the user the member mentioned in the command to see if it has a role
6 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.so member.roles.cache.has(' ') would work?
ideall you want to check cache first, and if it isn't cached you want to fetch
fetch automatically checks cache before actually fetching
So my slash command has the following option:
Then I take the data from the slash command option and I store it:
Then my question is how do I make it so if the user has a role the bot will continue with the command as I have set, for example if the user the staff mentions has member role it will do this otherwise nothing.
@psitota If you can help anytime please let me know