<commit_before>const path = require('path')
const Eris = require('eris').Client

const { Commander, Router, Bridge, Interpreter, Logger } = require('./core')
const { Collection } = require('./util')

/**
 * Interface between the Discord client and plugins
 * @version 3.0.0
 * @extends Eris.Client
 * @prop {Collection} plugins A Collection of plugins
 * @see {@link https://abal.moe/Eris/docs/Client|Eris.Client}
 */
class Client extends Eris {
  /**
   * Creates a new Client instance
   * @arg {Object} options An object containing sylphy's and/or Eris client options
   * @arg {String} options.token Discord bot token
   * @arg {String} [options.prefix='!'] Default prefix for commands
   * @arg {String} [options.admins=[]] Array of admin IDs
   * @arg {String} [options.commands] Relative path to commands folder
   * @arg {String} [options.modules] Relative path to modules folder
   * @arg {String} [options.middleware] Relative path to middleware folder
   * @arg {String} [options.locales] Relative path to locales folder
   * @arg {String} [options.resolvers] Relative path to resolvers folder
   * @arg {Boolean} [options.suppressWarnings=false] Option to suppress console warnings
   * @arg {Boolean} [options.noDefaults=false] Option to not use built-in plugins
   */
  constructor (options = {}) {
    super(options.token, options)
    this.prefix = options.prefix || '!'
    this.suppressWarnings = options.suppressWarnings
    this.noDefaults = options.noDefaults
    this.admins = Array.isArray(options.admins) ? options.admins : []

    this._resolvers = options.resolvers

    this.plugins = new Collection()

    if (!this.noDefaults) {
      this
      .createPlugin('commands', Commander)
      .createPlugin('modules', Router)
      .createPlugin('middleware', Bridge)
      .createPlugin('i18n', Interpreter)
      .createPlugin('logger', Logger)

      this.logger = this.plugins.get('logger')

      this.register('i18n', path.join(__dirname, '..', 'res/i18n'))
      this.register('middleware', path.join(__dirname, 'middleware'))

      if (options.commands) this.register('commands', options.commands)
      if (options.modules) this.register('modules', options.modules)
      if (options.middleware) this.register('middleware', options.middleware)
      if (options.locales) this.register('i18n', options.locales)
    }
  }

  /**
   * Creates a plugin
   * @arg {String} type The type of plugin
   * @arg {Plugin} Plugin Plugin class
   * @returns {Client}
   */
  createPlugin (type, Plugin) {
    const plugin = new Plugin(this)<commit_msg>Additional options for Plugins in createPlugin<commit_after>const path = require('path')
const Eris = require('eris').Client

const { Commander, Router, Bridge, Interpreter, Logger } = require('./core')
const { Collection } = require('./util')

/**
 * Interface between the Discord client and plugins
 * @version 3.0.0
 * @extends Eris.Client
 * @prop {Collection} plugins A Collection of plugins
 * @see {@link https://abal.moe/Eris/docs/Client|Eris.Client}
 */
class Client extends Eris {
  /**
   * Creates a new Client instance
   * @arg {Object} options An object containing sylphy's and/or Eris client options
   * @arg {String} options.token Discord bot token
   * @arg {String} [options.prefix='!'] Default prefix for commands
   * @arg {String} [options.admins=[]] Array of admin IDs
   * @arg {String} [options.commands] Relative path to commands folder
   * @arg {String} [options.modules] Relative path to modules folder
   * @arg {String} [options.middleware] Relative path to middleware folder
   * @arg {String} [options.locales] Relative path to locales folder
   * @arg {String} [options.resolvers] Relative path to resolvers folder
   * @arg {Boolean} [options.suppressWarnings=false] Option to suppress console warnings
   * @arg {Boolean} [options.noDefaults=false] Option to not use built-in plugins
   */
  constructor (options = {}) {
    super(options.token, options)
    this.prefix = options.prefix || '!'
    this.suppressWarnings = options.suppressWarnings
    this.noDefaults = options.noDefaults
    this.admins = Array.isArray(options.admins) ? options.admins : []

    this._resolvers = options.resolvers

    this.plugins = new Collection()

    if (!this.noDefaults) {
      this
      .createPlugin('commands', Commander, options)
      .createPlugin('modules', Router, options)
      .createPlugin('middleware', Bridge, options)
      .createPlugin('i18n', Interpreter, options)
      .createPlugin('logger', Logger, options)

      this.logger = this.plugins.get('logger')

      this.register('i18n', path.join(__dirname, '..', 'res/i18n'))
      this.register('middleware', path.join(__dirname, 'middleware'))

      if (options.commands) this.register('commands', options.commands)
      if (options.modules) this.register('modules', options.modules)
      if (options.middleware) this.register('middleware', options.middleware)
      if (options.locales) this.register('i18n', options.locales)
    }
  }

  /**
   * Creates a plugin
   * @arg {String} type The type of plugin
   * @arg {Plugin} Plugin Plugin class
   * @arg {Object} [options] Additional plugin options
   * @returns {Client}
   */
  createPlugin (type, Plugin, options) {
    const plugin = new Plugin(this, options)
{'fraction_non_alphanumeric': 0.130779392338177, 'fraction_numerical': 0.004151726740894509, 'mean_word_length': 3.7963800904977374, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2522243', 'n_tokens_mistral': 1591, 'n_tokens_neox': 1536, 'n_words': 443}