#How to check the user roles in interactionCreate

14 messages · Page 1 of 1 (latest)

cunning peak
#

i was trying interaction.member?.roles.cache.has however it says Property 'cache' does not exist on type 'string[] | GuildMemberRoleManager'. what is the proper way to check roles in an interaction?

robust holly
#

• 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.

dire gust
cunning peak
dire gust
#

if(!interaction.inCachedGuild()) return

cunning peak
#

i need to check a specific role though

#

thats my issue

dire gust
#

so you can use member.roles.cache

#

its not a replace

cunning peak
#

member.roles.cache doesnt exist according to my editor

dire gust
#

Thats why I told you to use interaction.inCachedGuild() typeguard

#

Perhaps you should brush up your ts a bit though