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

const fs = require('fs');
const path = require('path');
const color = require('chalk');
const { Collection } = require('discord.js');
const commandInfo = require('../locales/en_us/command.json');

/* eslint-disable no-sync */
let Commands = new Collection();
let Aliases = new Collection();

let commandFiles = fs.readdirSync(path.resolve('./modules/')).
  filter(file => !fs.statSync(path.resolve('./modules/', file)).isDirectory());

for (let file of commandFiles) {
  file = file.substr(0, file.length - 3);
  process.stdout.write(`${color.cyan('[Bastion]:')} Loading ${file} command...\n`);
  file = require(path.resolve(`./modules/${file}`));
  Commands.set(file.help.name.toLowerCase(), file);
  file.config.module = commandInfo[file.help.name].module;
  for (let alias of file.config.aliases) {
    Aliases.set(alias.toLowerCase(), file.help.name);
  }

  if (process.stdout.moveCursor) {
    process.stdout.moveCursor(0, -1);
  }
  if (process.stdout.clearLine) {
    process.stdout.clearLine();
  }
}

exports.commands = Commands;
exports.aliases = Aliases;
<commit_msg>moduleHandler: move cursor & clear line only when both are available<commit_after>/**
 * @file Module Handler
 * @author <NAME> (a.k.a k3rn31p4nic)
 * @license MIT
 */

const fs = require('fs');
const path = require('path');
const color = require('chalk');
const { Collection } = require('discord.js');
const commandInfo = require('../locales/en_us/command.json');

/* eslint-disable no-sync */
let Commands = new Collection();
let Aliases = new Collection();

let commandFiles = fs.readdirSync(path.resolve('./modules/')).
  filter(file => !fs.statSync(path.resolve('./modules/', file)).isDirectory());

for (let file of commandFiles) {
  file = file.substr(0, file.length - 3);
  process.stdout.write(`${color.cyan('[Bastion]:')} Loading ${file} command...\n`);
  file = require(path.resolve(`./modules/${file}`));
  Commands.set(file.help.name.toLowerCase(), file);
  file.config.module = commandInfo[file.help.name].module;
  for (let alias of file.config.aliases) {
    Aliases.set(alias.toLowerCase(), file.help.name);
  }

  if (process.stdout.moveCursor && process.stdout.clearLine) {
    process.stdout.moveCursor(0, -1);
    process.stdout.clearLine();
  }
}

exports.commands = Commands;
exports.aliases = Aliases;

{'fraction_non_alphanumeric': 0.18612380556709596, 'fraction_numerical': 0.006647278770253427, 'mean_word_length': 4.363028953229398, 'pattern_counts': {'":': 0, '<': 5, '<?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': '630738', 'n_tokens_mistral': 793, 'n_tokens_neox': 796, 'n_words': 164}