diff --git a/README.md b/README.md index df6689a1..a5968a46 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ If you self-host this you're nuts. 22. Run `pm2 start Xiao.js --name xiao` to run the bot. ## Commands -Total: 508 +Total: 509 ### Utility: diff --git a/commands/util/reload-file.js b/commands/util/reload-file.js new file mode 100644 index 00000000..02086877 --- /dev/null +++ b/commands/util/reload-file.js @@ -0,0 +1,35 @@ +const Command = require('../../framework/Command'); + +module.exports = class ReloadFileCommand extends Command { + constructor(client) { + super(client, { + name: 'reload-file', + group: 'util', + memberName: 'reload-file', + description: 'Reloads a file.', + details: 'Only the bot owner(s) may use this command.', + guarded: true, + ownerOnly: true, + args: [ + { + key: 'file', + type: 'string', + validate: file => { + try { + require.resolve(`../../${file}`); + return true; + } catch { + return false; + } + } + } + ] + }); + } + + run(msg, { file }) { + delete require.cache[require.resolve(`../../${file}`)]; + require(`../../${file}`); + return msg.say(`Reloaded \`${file}\`.`); + } +};