I'm working on a discord bot (This is just the AI module, there's another one connecting to the same bot for commands and stuff), but it doesnt know its own @Mention.
const token = process.env.PixelBot_token;
const keep_alive = require('./keep_alive.js');
const sendReply = require('./sendReply.js');
const Discord = require('discord.js');
const client = new Discord.Client();
// Set the client user's presence
client.on('ready', () => {
  var prefix = client.user.tag;
  console.log('PixelBot AI Loaded!');
  console.log(prefix);
});
client.on('message', message => {
  if (message.author.bot) return;
  var prefix = + client.user.tag;
  console.log(prefix);
  if (message.content.substring(0, prefix.length) === prefix) {
    //useful variables
    const args = message.content.slice(prefix.length).trim().split(/ +/g);
    const command = args.shift().toLowerCase();
    if (command === "help") {
      console.info("Help Message Sent!\n");
    };
  };
});
client.login(token);
The above code prints out:
PixelBot AI Loaded!
PixelBot#9188
But does nothing when I send @PixelBot help. However, if I change the prefix to a string, eg: "pb", it works. It obviously knows it in "client.on('ready')", as it gets printed out. Any ideas?
EDIT: Here is the code with @Discord Expert's suggestion in:
const token = process.env.PixelBot_token;
const keep_alive = require('./keep_alive.js');
const sendReply = require('./sendReply.js');
const Discord = require('discord.js');
const client = new Discord.Client();
// Set the client user's presence
client.on('ready', () => {
  console.log('PixelBot AI Loaded!');
});
client.on('message', message => {
  if (message.author.bot) return;
  if (message.mentions.users.first() === client.user) {
    //useful variables
    const command = message.content.slice(message.mentions.users.first().length).trim().split(/ +/g);
    const identifier = command.shift().toLowerCase();
    console.log('identifier = "' + identifier + '"');
    console.log('command = "' + command +'"');
    console.log('message content = "' + message.content + '"');
    if (command === "help") {
      console.info("Help Message Sent!\n");
    };
  };
});
client.login(token);
This prints out:
PixelBot AI Loaded!
identifier = "<@569971848322744320>"
command = "help"
message content = "<@569971848322744320> help"
So it knows that command === "help", so why does it not execute the if statement?
 
     
    