Discord bot client.user.tag not working

javascript

#1
This is my code right now:
    if (message.content.includes(client.user.tag)) {
            message.channel.send('Text here')
      console.log(message.author.tag + " just tagged me").catch(console.error)

But when I tag my bot it doesn’t work. What’s going on?


#2

Can you send me your whole file so I can identify the problem? (Message me) Also, remember to remove your token when showing your bot’s code.


#3

Hey, client.user.tag is the user tag, example: something#1234. So when you mention the bot it does not trigger. You can use this:
if(message.isMentioned(client.user)){ // your code here }

This triggers whenever your bot gets mentioned in a channel it can read. You do have to add this to your message event.