<commit_before>async function onMessageCreate (msg) {
  if (msg.author.bot) {
    return;
  }

  const mentionPrefix = msg.content.match(new RegExp(`^<@!*${this.client.user.id}>`));
  const prefix = mentionPrefix ? `${mentionPrefix[0]} ` : await this.db.getPrefix(msg.channel.guild.id);
  if (!msg.content.startsWith(prefix)) {
    return;
  }

  const args = msg.content.slice(prefix.length).split(' ').filter(Boolean);
  let command = args.shift();

  if (command in this.commands) {
    command = this.commands[command];
  } else {
    const potentialCommand = Object.keys(this.commands).find(c => this.commands[c].aliases.includes(command));
    if (potentialCommand) {
      command = this.commands[potentialCommand];
    }
  }

  if (command && command instanceof Object) {
    if (command.ownerOnly && msg.author.id !== this.config.ownerID) {
      return;
    }

    command.call.call(this, msg, args)
      .then(res => {
        if (res && (typeof res === 'string' || res instanceof Object)) {
          this.sendMessage(msg.channel.id, res);
        }
      })
      .catch(e => {
        this.log(e.stack, 'error');
        msg.channel.createMessage('Something went wrong while executing this command. The error has been logged. \nPlease join here (Yphr6WG) if the issue persists.');
      });
  } else if (
    msg.mentions.find(u => u.id === this.client.user.id) &&
    msg.content.toLowerCase().includes('help')
  ) {
    return this.commands['help'].call.call(null, msg);
  }
}

module.exports = onMessageCreate;<commit_msg>Make commands case insensitive, display error message<commit_after>async function onMessageCreate (msg) {
  if (msg.author.bot) {
    return;
  }

  const mentionPrefix = msg.content.match(new RegExp(`^<@!*${this.client.user.id}>`));
  const prefix = mentionPrefix ? `${mentionPrefix[0]} ` : await this.db.getPrefix(msg.channel.guild.id);
  if (!msg.content.startsWith(prefix)) {
    return;
  }

  const args = msg.content.slice(prefix.length).split(' ').filter(Boolean);
  let command = args.shift().toLowerCase();

  if (command in this.commands) {
    command = this.commands[command];
  } else {
    const potentialCommand = Object.keys(this.commands).find(c => this.commands[c].aliases.includes(command));
    if (potentialCommand) {
      command = this.commands[potentialCommand];
    }
  }

  if (command && command instanceof Object) {
    if (command.ownerOnly && msg.author.id !== this.config.ownerID) {
      return;
    }

    command.call.call(this, msg, args)
      .then(res => {
        if (res && (typeof res === 'string' || res instanceof Object)) {
          this.sendMessage(msg.channel.id, res);
        }
      })
      .catch(e => {
        this.log(e.stack, 'error');
        msg.channel.createMessage(`Something went wrong while executing this command. The error has been logged. \nPlease join here (discord.gg/Yphr6WG) if the issue persists.\n\`\`\`${e.message}\`\`\``);
      });
  } else if (
    msg.mentions.find(u => u.id === this.client.user.id) &&
    msg.content.toLowerCase().includes('help')
  ) {
    return this.commands['help'].call.call(null, msg);
  }
}

module.exports = onMessageCreate;
{'fraction_non_alphanumeric': 0.16493219804478082, 'fraction_numerical': 0.001261431725007884, 'mean_word_length': 3.1627296587926508, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4208030', 'n_tokens_mistral': 1014, 'n_tokens_neox': 1006, 'n_words': 205}