From b20d409e24969b58206b1504b1f4042a3067b3e0 Mon Sep 17 00:00:00 2001 From: Navy Date: Fri, 1 May 2020 17:12:37 +0300 Subject: [PATCH] beginning of reload --- .../components/commands/developer/Reload.js | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 structure/client/components/commands/developer/Reload.js diff --git a/structure/client/components/commands/developer/Reload.js b/structure/client/components/commands/developer/Reload.js new file mode 100644 index 0000000..9b70e5e --- /dev/null +++ b/structure/client/components/commands/developer/Reload.js @@ -0,0 +1,55 @@ +const { Command, Argument } = require('../../../../interfaces/'); + +class ReloadCommand extends Command { + + constructor(client) { + + super(client, { + name: 'reload', + module: 'developer', + description: 'Reloads components', + restricted: true, + aliases: ['r'], + arguments: [ + new Argument(client, { + name: 'language', + type: 'STRING', + types: ['FLAG'], + aliases: [ 'lang' ], + description: "Reloads the language library", + default: 'all' + }) + ] + }); + + this.client = client; + + + } + + async execute(message, { args }) { + + //console.log(args); + //message.respond('lol'); + + if (args.language) { + if (args.language.value === 'all') { + await this.client.localeLoader.loadLanguages(); + return message.respond('Reloaded all languages'); + } else { + try { + await this.client.localeLoader.loadLanguage(args.language.value); + return message.respond(`Reloaded locale \`${args.language.value}\``); + } catch (err) { + return message.respond(err.message); + } + + } + + } + + } + +} + +module.exports = ReloadCommand; \ No newline at end of file