From 1a0fe6ee2dbfd60a606a05f6a670aa8529616b22 Mon Sep 17 00:00:00 2001 From: MatteZ02 <47610069+MatteZ02@users.noreply.github.com> Date: Mon, 24 Feb 2020 21:11:27 +0200 Subject: [PATCH] Create reload.js --- commands/reload.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 commands/reload.js diff --git a/commands/reload.js b/commands/reload.js new file mode 100644 index 00000000..bd35156a --- /dev/null +++ b/commands/reload.js @@ -0,0 +1,27 @@ +module.exports = { + name: 'reload', + alias: 'reload', + usage: '', + description: 'Reload all files', + onlyDev: true, + permission: 'none', + category: 'util', + async execute(msg, args, client, Discord, prefix, command) { + const commandFiles = fs.readdirSync(path.join(path.dirname(__dirname), 'commands')).filter(f => f.endsWith('.js')); + for (const file of commandFiles) { + const command = require(`./${file}`); + command.uses = 0; + client.commands.set(command.name, command); + client.commandAliases.set(command.alias, command); + } + const settingFiles = fs.readdirSync(path.join(path.dirname(__dirname), 'commands/settings')).filter(f => f.endsWith('.js')); + for (const file of settingFiles) { + const option = require(`./settings/${file}`); + client.settingCmd.set(option.name, option); + } + fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => { + this.funcs[filename.slice(0, -3)] = require(`../struct/funcs/${filename}`); + }); + msg.channel.send('All files reloaded!'); + } +};