get role through data

I'm saving the data like this:
No description
2 Replies
d.js toolkit
d.js toolkit14mo 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
Forhand.
Forhand.OP14mo ago
so I want to check if user has the role that in object key then do the command I used this before:
for (const key in jsonfile) {
if (message.member.roles.cache.has(`${key}`)) {
do the command
} else {
return message.react(❌);
}
}
for (const key in jsonfile) {
if (message.member.roles.cache.has(`${key}`)) {
do the command
} else {
return message.react(❌);
}
}
it was working at the first bot after some restarts of the bot it doesn't work now, it returns with react the message in else case
Want results from more Discord servers?
Add your server