permission fetch error

async execute(interaction) {
const pem = interaction.member.roles.cache.has('role1||'role2'||'role3');
console.log(interaction.member.roles.cache.has('role1'));
console.log(interaction.member.roles.cache.has('role2'));
console.log(interaction.member.roles.cache.has('role3'));
console.log(interaction.member.roles.cache.has('role1'||'role2'));
console.log(interaction.member.roles.cache.has('role1'||'role3'));
console.log(interaction.member.roles.cache.has('role2'||'role3'));
if (pem == true) {}
else {}
}
async execute(interaction) {
const pem = interaction.member.roles.cache.has('role1||'role2'||'role3');
console.log(interaction.member.roles.cache.has('role1'));
console.log(interaction.member.roles.cache.has('role2'));
console.log(interaction.member.roles.cache.has('role3'));
console.log(interaction.member.roles.cache.has('role1'||'role2'));
console.log(interaction.member.roles.cache.has('role1'||'role3'));
console.log(interaction.member.roles.cache.has('role2'||'role3'));
if (pem == true) {}
else {}
}
if i have role1 it work well if i have role2&role3 it doesn't work.
5 Replies
d.js toolkit
d.js toolkit2w 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! - Marked as resolved by OP
d.js docs
d.js docs2w ago
:method: Collection#hasAny() @2.1.1 Checks if any of the elements exist in the collection. :method: Collection#hasAny() @2.1.1 Checks if any of the elements exist in the collection.
Unicorn.
Unicorn.OP2w ago
│ └── [email protected] deduped

ndoe:v18.17.1
│ └── [email protected] deduped

ndoe:v18.17.1
Mark
Mark2w ago
use the hasAny method, as we both linked above ( :mmLol: ) has() is for a single key only
Unicorn.
Unicorn.OP2w ago
i'll try it thx for that it work well now ❤️
Want results from more Discord servers?
Add your server