Haha-Yes/commands/reload.js

17 lines
611 B
JavaScript
Raw Normal View History

2018-09-06 15:02:53 +02:00
exports.run = (client, message, args) => {
if (message.author.id == "267065637183029248") {
if(!args || args.size < 1) return message.reply("Must provide a command name to reload.");
const commandName = args[0];
if(!client.commands.has(commandName)) {
return message.reply("That command does not exist");
}
delete require.cache[require.resolve(`./${commandName}.js`)];
client.commands.delete(commandName);
const props = require(`./${commandName}.js`);
client.commands.set(commandName, props);
message.reply(`The command ${commandName} has been reloaded`);
};
}