Fix reload command
This commit is contained in:
parent
3235944d83
commit
9e9cf31329
1 changed files with 24 additions and 22 deletions
|
@ -6,31 +6,33 @@ class ReloadCommand extends Command {
|
||||||
aliases: ['reload', 'r'],
|
aliases: ['reload', 'r'],
|
||||||
ownerOnly: true,
|
ownerOnly: true,
|
||||||
quoted: false,
|
quoted: false,
|
||||||
clientPermissions: ['SEND_MESSAGES'],
|
clientPermissions: ['SEND_MESSAGES']
|
||||||
args: [
|
});
|
||||||
{
|
}
|
||||||
id: 'type',
|
|
||||||
|
*args() {
|
||||||
|
const type = yield {
|
||||||
match: 'option',
|
match: 'option',
|
||||||
flag: ['type:'],
|
flag: ['type:'],
|
||||||
type: [['command', 'c'], ['listener', 'l']],
|
type: [['command', 'c'], ['listener', 'l']],
|
||||||
default: 'command'
|
default: 'command'
|
||||||
},
|
};
|
||||||
{
|
|
||||||
id: 'module',
|
const mod = yield {
|
||||||
type: (phrase, message, { type }) => {
|
type: (message, phrase) => {
|
||||||
if (!phrase) return null;
|
if (!phrase) return null;
|
||||||
const resolver = this.handler.resolver.type({
|
const resolver = this.handler.resolver.type({
|
||||||
command: 'commandAlias',
|
command: 'commandAlias',
|
||||||
listener: 'listener'
|
listener: 'listener'
|
||||||
}[type]);
|
}[type]);
|
||||||
return resolver(phrase);
|
return resolver(message, phrase);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
]
|
|
||||||
});
|
return { type, mod };
|
||||||
}
|
}
|
||||||
|
|
||||||
exec(message, { type, module: mod }) {
|
exec(message, { type, mod }) {
|
||||||
if (!mod) {
|
if (!mod) {
|
||||||
return message.util.send(`Invalid ${type} ${type === 'command' ? 'alias' : 'ID'} specified to reload.`);
|
return message.util.send(`Invalid ${type} ${type === 'command' ? 'alias' : 'ID'} specified to reload.`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue