{"size": 1110, "ext": "js", "max_stars_repo_path": "commands/reload.js", "max_stars_repo_name": "MrAugu/grow-surgery", "max_stars_repo_stars_event_min_datetime": "2021-11-23T05:28:43.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-23T05:28:43.000Z", "max_issues_repo_path": "commands/reload.js", "max_issues_repo_name": "cwkhawand/grow-surgery", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "commands/reload.js", "max_forks_repo_name": "cwkhawand/grow-surgery", "max_forks_repo_forks_event_min_datetime": "2019-09-08T16:31:30.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T10:41:10.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 11, "avg_line_length": 32.6470588235, "max_line_length": 117, "alphanum_fraction": 0.6468468468}
const Command = require("../base/Command.js");

class Reload extends Command {
  constructor (client) {
    super(client, {
      name: "reload",
      description: "Reloads a command.",
      category: "Bot Admin",
      usage: "<command>",
      enabled: true,
      guildOnly: false,
      aliases: ["r"],
      permLevel: "Bot Admin",
      cooldown: 5,
      args: true
    });
  }

  async run (message, args, level, reply) { // eslint-disable-line no-unused-vars  
    const commands = this.client.commands.get(args[0]) || this.client.commands.get(this.client.aliases.get(args[0]));
    if (!commands) return reply(`The command \`${args[0]}\` does not exist, nor is an alias.`);

    let response = await this.client.unloadCommand(commands.conf.location, commands.help.name);
    if (response) return reply(`Error Unloading The Command: ${response}`);

    response = this.client.loadCommand(commands.conf.location, commands.help.name);
    if (response) return reply(`Error Loading The Command: ${response}`);

    reply(`\`${commands.help.name}\` has been reloaded.`);
  }
}

module.exports = Reload;
