<commit_before>/**
 * @file report command
 * @author <NAME> (a.k.a k3rn31p4nic)
 * @license GPL-3.0
 */

exports.exec = async (Bastion, message, args) => {
  try {
    if (!args.user || !args.reason) {
      /**
       * The command was ran with invalid parameters.
       * @fires commandUsage
       */
      return Bastion.emit('commandUsage', message, this.help);
    }


    let guildModel = await Bastion.database.models.guild.findOne({
      attributes: [ 'reportChannel' ],
      where: {
        guildID: message.guild.id
      }
    });

    if (guildModel && guildModel.dataValues.reportChannel && message.guild.channels.has(guildModel.dataValues.reportChannel)) {
      let user;
      if (args.user.startsWith('<@') && message.mentions.users.size) {
        user = message.mentions.users.first();
      }
      else {
        let member = message.guild.members.get(args.user);
        if (member) {
          user = member.user;
        }
      }

      if (!user) {
        return Bastion.emit('error', '', Bastion.i18n.error(message.guild.language, 'notFound', 'users'), message.channel);
      }

      if (message.author.id === user.id) return;

      args.reason = args.reason.join(' ');


      let reportChannel = message.guild.channels.get(guildModel.dataValues.reportChannel);
      reportChannel.send({
        embed: {
          color: Bastion.colors.ORANGE,
          title: 'User Report',
          fields: [
            {
              name: 'User',
              value: user.tag,
              inline: true
            },
            {
              name: 'User ID',
              value: user.id,
              inline: true
            },
            {
              name: 'Report',
              value: args.reason
            }
          ],
          footer: {<commit_msg>commands: fixed a typo in a string in report command<commit_after>/**
 * @file report command
 * @author <NAME> (a.k.a k3rn31p4nic)
 * @license GPL-3.0
 */

exports.exec = async (Bastion, message, args) => {
  try {
    if (!args.user || !args.reason) {
      /**
       * The command was ran with invalid parameters.
       * @fires commandUsage
       */
      return Bastion.emit('commandUsage', message, this.help);
    }


    let guildModel = await Bastion.database.models.guild.findOne({
      attributes: [ 'reportChannel' ],
      where: {
        guildID: message.guild.id
      }
    });

    if (guildModel && guildModel.dataValues.reportChannel && message.guild.channels.has(guildModel.dataValues.reportChannel)) {
      let user;
      if (args.user.startsWith('<@') && message.mentions.users.size) {
        user = message.mentions.users.first();
      }
      else {
        let member = message.guild.members.get(args.user);
        if (member) {
          user = member.user;
        }
      }

      if (!user) {
        return Bastion.emit('error', '', Bastion.i18n.error(message.guild.language, 'notFound', 'user'), message.channel);
      }

      if (message.author.id === user.id) return;

      args.reason = args.reason.join(' ');


      let reportChannel = message.guild.channels.get(guildModel.dataValues.reportChannel);
      reportChannel.send({
        embed: {
          color: Bastion.colors.ORANGE,
          title: 'User Report',
          fields: [
            {
              name: 'User',
              value: user.tag,
              inline: true
            },
            {
              name: 'User ID',
              value: user.id,
              inline: true
            },
            {
              name: 'Report',
              value: args.reason
            }
          ],
          footer: {
{'fraction_non_alphanumeric': 0.13474204171240395, 'fraction_numerical': 0.0043907793633369925, 'mean_word_length': 1.7080237741456166, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2203075', 'n_tokens_mistral': 1096, 'n_tokens_neox': 1065, 'n_words': 215}