From 9e9cf31329b93a78658bdc04974c9782c0189374 Mon Sep 17 00:00:00 2001 From: 1computer1 Date: Thu, 16 May 2019 20:54:14 -0400 Subject: [PATCH] Fix reload command --- src/commands/reload.js | 46 ++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/commands/reload.js b/src/commands/reload.js index 12769e8..431d23a 100644 --- a/src/commands/reload.js +++ b/src/commands/reload.js @@ -6,31 +6,33 @@ class ReloadCommand extends Command { aliases: ['reload', 'r'], ownerOnly: true, quoted: false, - clientPermissions: ['SEND_MESSAGES'], - args: [ - { - id: 'type', - match: 'option', - flag: ['type:'], - type: [['command', 'c'], ['listener', 'l']], - default: 'command' - }, - { - id: 'module', - type: (phrase, message, { type }) => { - if (!phrase) return null; - const resolver = this.handler.resolver.type({ - command: 'commandAlias', - listener: 'listener' - }[type]); - return resolver(phrase); - } - } - ] + clientPermissions: ['SEND_MESSAGES'] }); } - exec(message, { type, module: mod }) { + *args() { + const type = yield { + match: 'option', + flag: ['type:'], + type: [['command', 'c'], ['listener', 'l']], + default: 'command' + }; + + const mod = yield { + type: (message, phrase) => { + if (!phrase) return null; + const resolver = this.handler.resolver.type({ + command: 'commandAlias', + listener: 'listener' + }[type]); + return resolver(message, phrase); + } + }; + + return { type, mod }; + } + + exec(message, { type, mod }) { if (!mod) { return message.util.send(`Invalid ${type} ${type === 'command' ? 'alias' : 'ID'} specified to reload.`); }