Make the unloaded command unique so multiples command can be disabled

This commit is contained in:
loicbersier 2019-11-22 12:55:56 +01:00
parent 5778bc5337
commit c0df5e0367

View file

@ -29,7 +29,7 @@ class unloadCommand extends Command {
async exec(message, args) { async exec(message, args) {
this.handler.remove(args.command); this.handler.remove(args.command);
if (!args.noplaceholder) { if (!args.noplaceholder) {
fs.writeFile('./unloaded.js', `const { Command } = require('discord-akairo'); fs.writeFile(`./${args.command}_unloaded.js`, `const { Command } = require('discord-akairo');
class ${args.command}Command extends Command { class ${args.command}Command extends Command {
constructor() { constructor() {
@ -49,8 +49,7 @@ class unloadCommand extends Command {
} }
module.exports = ${args.command}Command;`,() => { module.exports = ${args.command}Command;`,() => {
this.handler.load(`${__dirname}/../../unloaded.js`); this.handler.load(`${__dirname}/../../${args.command}_unloaded.js`);
}); });
} }
return message.channel.send(`Sucessfully unloaded command ${args.command}`); return message.channel.send(`Sucessfully unloaded command ${args.command}`);