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

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

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

  let suggestionChannel;
  if (guildSettings.suggestionChannel) {
    suggestionChannel = message.guild.channels.filter(channel => channel.type === 'text').get(guildSettings.suggestionChannel);
  }

  if (!suggestionChannel) {
    suggestionChannel = message.channel;
  }

  suggestionChannel.send({
    embed: {
      title: 'Suggestion',
      description: args.description.join(' '),
      footer: {
        text: `Suggested by ${message.author.tag}`
      }
    }
  }).catch(e => {
    Bastion.log.error(e);
  });
};

exports.config = {
  aliases: [],
  enabled: true,
  argsDefinitions: [
    { name: 'description', type: String, multiple: true, defaultOption: true }<commit_msg>Improvements to suggestion command * Auto delete user's message after the submission is successful. * Added reactions for voting * Code improvements<commit_after>/**
 * @file suggest command
 * @author <NAME> (a.k.a k3rn31p4nic)
 * @license MIT
 */

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

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

    let suggestionChannel;
    if (guildSettings.suggestionChannel) {
      suggestionChannel = message.guild.channels.filter(channel => channel.type === 'text').get(guildSettings.suggestionChannel);
    }

    if (!suggestionChannel) {
      suggestionChannel = message.channel;
    }

    let suggestion = await suggestionChannel.send({
      embed: {
        title: 'Suggestion',
        description: args.description.join(' '),
        footer: {
          text: `Suggested by ${message.author.tag}`
        }
      }
    });

    // Delete user's message
    if (message.deletable) {
      message.delete().catch(() => {});
    }

    // Add reactions for voting
    await suggestion.react('👍');
    await suggestion.react('👎');
  }
  catch (e) {
    Bastion.log.error(e);
  }
};

exports.config = {
  aliases: [],
  enabled: true,
  argsDefinitions: [
    { name: 'description', type: String, multiple: true, defaultOption: true }
{'fraction_non_alphanumeric': 0.13897058823529412, 'fraction_numerical': 0.0029411764705882353, 'mean_word_length': 3.1040723981900453, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '1344357', 'n_tokens_mistral': 837, 'n_tokens_neox': 812, 'n_words': 191}