DiscordJS GuildMemberRoleManager doesn't have a cache
Solution 1:
As Elitezen kindly pointed out, interaction.member.roles
is a string[]
instead of a GuildMemberRoleManager
. I manually casted it to the correct type and it worked!
let roles = (interaction.member.roles as GuildMemberRoleManager).cache;
let isAdmin = roles.some(
(role) => role.name === "admin")
);