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

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

    let guildSettings = await Bastion.db.get(`SELECT filteredWords FROM guildSettings WHERE guildID=${message.guild.id}`);

    let filteredWords = [];
    if (guildSettings.filteredWords) {
      filteredWords = guildSettings.filteredWords.split(' ');
    }
    filteredWords = filteredWords.concat(args);
    filteredWords = [ ...new Set(filteredWords) ];

    await Bastion.db.run(`UPDATE guildSettings SET filteredWords='${filteredWords.join(' ')}' WHERE guildID=${message.guild.id}`);

    message.channel.send({
      embed: {<commit_msg>Implemented new DB - addFilteredWords command<commit_after>/**
 * @file addFilteredWords command
 * @author <NAME> (a.k.a k3rn31p4nic)
 * @license MIT
 */

exports.exec = async (Bastion, message, args) => {
  try {
    if (args.length < 1) {
      /**
      * 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: [ 'filteredWords' ],
      where: {
        guildID: message.guild.id
      }
    });

    let filteredWords = [];
    if (guildModel.dataValues.filteredWords) {
      filteredWords = guildModel.dataValues.filteredWords.split(' ');
    }
    filteredWords = filteredWords.concat(args);
    filteredWords = [ ...new Set(filteredWords) ];

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

    message.channel.send({
      embed: {
{'fraction_non_alphanumeric': 0.1377755511022044, 'fraction_numerical': 0.00501002004008016, 'mean_word_length': 2.833013435700576, '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': '7543931', 'n_tokens_mistral': 659, 'n_tokens_neox': 605, 'n_words': 128}