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

exports.exec = async (Bastion, message) => {
  try {
    let guildSettings = await Bastion.db.get(`SELECT greet FROM guildSettings WHERE guildID=${message.guild.id}`);

    let color, greetStats;
    if (guildSettings.greet === message.channel.id) {
      Bastion.db.run(`UPDATE guildSettings SET greet=null WHERE guildID=${message.guild.id}`);
      color = Bastion.colors.RED;
      greetStats = Bastion.strings.info(message.guild.language, 'disableGreetingMessages', message.author.tag);
    }
    else {
      Bastion.db.run(`UPDATE guildSettings SET greet=${message.channel.id} WHERE guildID=${message.guild.id}`);
      color = Bastion.colors.GREEN;
      greetStats = Bastion.strings.info(message.guild.language, 'enableGreetingMessages', message.author.tag);
    }

    message.channel.send({
      embed: {
        color: color,
        description: greetStats
      }
    }).catch(e => {
      Bastion.log.error(e);
    });
  }
  catch (e) {
    Bastion.log.error(e);
  }
};

exports.config = {
  aliases: [],
  enabled: true
};<commit_msg>Implemented new DB - greet command<commit_after>/**
 * @file greet command
 * @author <NAME> (a.k.a k3rn31p4nic)
 * @license MIT
 */

exports.exec = async (Bastion, message) => {
  try {
    let guildModel = await Bastion.database.models.guild.findOne({
      attributes: [ 'greet' ],
      where: {
        guildID: message.guild.id
      }
    });

    let color, greetStats;
    if (guildModel.dataValues.greet === message.channel.id) {
      await Bastion.database.models.guild.update({
        greet: null
      },
      {
        where: {
          guildID: message.guild.id
        },
        fields: [ 'greet' ]
      });
      color = Bastion.colors.RED;
      greetStats = Bastion.strings.info(message.guild.language, 'disableGreetingMessages', message.author.tag);
    }
    else {
      await Bastion.database.models.guild.update({
        greet: message.channel.id
      },
      {
        where: {
          guildID: message.guild.id
        },
        fields: [ 'greet' ]
      });
      color = Bastion.colors.GREEN;
      greetStats = Bastion.strings.info(message.guild.language, 'enableGreetingMessages', message.author.tag);
    }

    message.channel.send({
      embed: {
        color: color,
        description: greetStats
      }
    }).catch(e => {
      Bastion.log.error(e);
    });
  }
  catch (e) {
    Bastion.log.error(e);
  }
};

exports.config = {
  aliases: [],
  enabled: true
};
{'fraction_non_alphanumeric': 0.1461418550272798, 'fraction_numerical': 0.003117692907248636, 'mean_word_length': 2.4642375168690958, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '7193345', 'n_tokens_mistral': 867, 'n_tokens_neox': 857, 'n_words': 150}