Hello everyone, I'm new to asking questions here so please bear with me. I am trying to retrieve all the users mentioned in a message and check if any of them have a specific role, such as the staff role.
Thank you for your help!
Edit: Here is the code I have written:
message.mentions.users.forEach((user => {
console.log(user)
if(user.roles.cache.has('817753474791768074')) {
message.channel.send('Stop pinging a Staff!')
}
}))
However, I am encountering an issue where it cannot read the property of cache. Can anyone point out what I did wrong?
Edit: 2
I found the problem - Guild Members and Users are different entities, so I needed to adjust my code accordingly like this
message.mentions.members.forEach((user => {
console.log(user)
if(user.roles.cache.has('817753474791768074')) {
message.channel.send('Stop pinging a Staff!')
}
}))
Thank you to everyone who assisted me, I have learned how to ask questions on stackoverflow more effectively.