1
0
Fork 0

Reverting and fixing command reloader

refactor/models
Bsian 2019-12-01 00:22:51 +00:00
parent f7822fa2cb
commit c11a7e62c3
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 4 additions and 2 deletions

View File

@ -22,12 +22,14 @@ export default class Load extends Command {
const corepath = '/var/CloudServices/dist'; const corepath = '/var/CloudServices/dist';
if (type === 'config') this.client.config = require(`${corepath}/config.json`); if (type === 'config') this.client.config = require(`${corepath}/config.json`);
else if (type === 'util') { else if (type === 'util') {
const Util = require(`${corepath}/class/Util`).default; const Util = require(`${corepath}/class/Util`);
this.client.util = new Util(this.client); this.client.util = new Util(this.client);
} else { } else {
try { try {
const Cmd = require(`${corepath}/commands`)[args[1]]; const cmdIndex = require(`${corepath}/commands`);
let Cmd = cmdIndex[args[1]];
if (!Cmd) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Could not find file***`); if (!Cmd) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Could not find file***`);
Cmd = require(`${corepath}/commands/${args[1]}`);
this.client.commands.remove(args[1]); this.client.commands.remove(args[1]);
this.client.loadCommand(Cmd); this.client.loadCommand(Cmd);
} catch (error) { } catch (error) {