Firas
Firas

Reputation: 35

How to check if a member has mentioned a specific user?

I want to check if a member has mentioned/pinged/tagged a specific user, that's it. This is what I've tried:

client.on('message' async message => {

const vips = [<@(someid)>] 

if(message.content.includes(vips){

(the rest of my code) 

}


});

Upvotes: 1

Views: 181

Answers (1)

Syntle
Syntle

Reputation: 5174

client.on('message', (message) => {
  if (message.mentions.users.some((user) => user.id === USER_ID)) {
    message.member.roles.add(ROLE_ID)
  }
})

Upvotes: 1

Related Questions