{"size": 561, "ext": "js", "max_stars_repo_path": "core/loaders/CommandLoader.js", "max_stars_repo_name": "retromada/discord", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "core/loaders/CommandLoader.js", "max_issues_repo_name": "retromada/discord", "max_issues_repo_issues_event_min_datetime": "2020-03-25T04:12:45.000Z", "max_issues_repo_issues_event_max_datetime": "2020-03-25T04:12:45.000Z", "max_forks_repo_path": "core/loaders/CommandLoader.js", "max_forks_repo_name": "retromada/discord", "max_forks_repo_forks_event_min_datetime": "2020-04-14T23:59:23.000Z", "max_forks_repo_forks_event_max_datetime": "2020-04-23T00:39:13.000Z"}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": 3, "avg_line_length": 26.7142857143, "max_line_length": 83, "alphanum_fraction": 0.6577540107}
const { Collection } = require('discord.js')
const { FileUtils } = require('../')

module.exports = {
  load(client) {
    this.initializeCommands(client)
  },

  initializeCommands(client, directory = 'core/commands') {
    client.commands = new Collection()
    client.aliases = new Collection()

    return FileUtils.requireDirectory(directory, (command) => {
      client.commands.set(command.name, command)

      if (command.aliases) {
        command.aliases.forEach((alias) => client.aliases.set(alias, command.name))
      }
    }, console.error)
  }
}