<commit_before>/**
 * @file setPrefix command
 * @author <NAME> (a.k.a k3rn31p4nic)
 * @license MIT
 */

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

    let prefix, maxPrefix = 5, prefixMaxLength = 8;
    if (args.default) {
      prefix = Bastion.config.prefix;
    }
    else {
      if (args.prefix.length > maxPrefix) {
        /**
        * Error condition is encountered.
        * @fires error
        */
        return Bastion.emit('error', Bastion.strings.error(message.guild.language, 'invalidInput'), `You can only add a maximum of ${maxPrefix} prefixes.`, message.channel);
      }
      prefix = args.prefix.join(' ');
      if (args.prefix.some(prefix => prefix.length > prefixMaxLength)) {
        /**
        * Error condition is encountered.
        * @fires error
        */
        return Bastion.emit('error', Bastion.strings.error(message.guild.language, 'invalidInput'), Bastion.strings.error(message.guild.language, 'prefixRange', true, prefixMaxLength), message.channel);
      }
    }

    await Bastion.database.models.guild.update({
      prefix: prefix
    },
    {
      where: {
        guildID: message.guild.id
      },
      fields: [ 'prefix' ]
    });

    message.channel.send({
      embed: {
        color: Bastion.colors.GREEN,
        description: Bastion.strings.info(message.guild.language, 'setPrefix', message.author.tag, prefix)
      }
    }).catch(e => {
      Bastion.log.error(e);
    });<commit_msg>Updated setPrefix command to implement datatype changes to prefix field<commit_after>/**
 * @file setPrefix command
 * @author <NAME> (a.k.a k3rn31p4nic)
 * @license MIT
 */

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

    let prefix, maxPrefix = 5, prefixMaxLength = 8;
    if (args.default) {
      prefix = [ Bastion.config.prefix ];
    }
    else {
      if (args.prefix.length > maxPrefix) {
        /**
        * Error condition is encountered.
        * @fires error
        */
        return Bastion.emit('error', Bastion.strings.error(message.guild.language, 'invalidInput'), `You can only add a maximum of ${maxPrefix} prefixes.`, message.channel);
      }
      prefix = args.prefix;
      if (args.prefix.some(prefix => prefix.length > prefixMaxLength)) {
        /**
        * Error condition is encountered.
        * @fires error
        */
        return Bastion.emit('error', Bastion.strings.error(message.guild.language, 'invalidInput'), Bastion.strings.error(message.guild.language, 'prefixRange', true, prefixMaxLength), message.channel);
      }
    }

    await Bastion.database.models.guild.update({
      prefix: prefix
    },
    {
      where: {
        guildID: message.guild.id
      },
      fields: [ 'prefix' ]
    });

    message.channel.send({
      embed: {
        color: Bastion.colors.GREEN,
        description: Bastion.strings.info(message.guild.language, 'setPrefix', message.author.tag, prefix)
      }
    }).catch(e => {
      Bastion.log.error(e);
    });
{'fraction_non_alphanumeric': 0.13962375073486186, 'fraction_numerical': 0.003527336860670194, 'mean_word_length': 2.3759920634920637, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '2114509', 'n_tokens_mistral': 1037, 'n_tokens_neox': 1022, 'n_words': 223}