forked from Supositware/Haha-Yes
Finally(?) fix command flags
This commit is contained in:
parent
1a87dbb325
commit
3143e478cd
1 changed files with 7 additions and 5 deletions
|
@ -370,15 +370,17 @@ export default {
|
||||||
};
|
};
|
||||||
const args = {};
|
const args = {};
|
||||||
|
|
||||||
for (let i = 0; i < command.data.options.length; i++) {
|
for (let i = 0, j = 0; i < command.data.options.length; i++, j++) {
|
||||||
if (!messageArgs[i]) continue;
|
if (!messageArgs[i]) continue;
|
||||||
const arg = command.data.options[i];
|
const arg = command.data.options[j];
|
||||||
const type = arg.constructor.name.toLowerCase();
|
const type = arg.constructor.name.toLowerCase();
|
||||||
|
let payloadName = arg.name;
|
||||||
let payload = messageArgs[i];
|
let payload = messageArgs[i];
|
||||||
|
|
||||||
if (payload.startsWith('--')) {
|
if (messageArgs[i].startsWith('--')) {
|
||||||
arg.name = payload.substring(2);
|
payloadName = payload.substring(2);
|
||||||
payload = true;
|
payload = true;
|
||||||
|
j--;
|
||||||
}
|
}
|
||||||
else if (type.includes('mentionable')) {
|
else if (type.includes('mentionable')) {
|
||||||
payload = message.mentions.members.first();
|
payload = message.mentions.members.first();
|
||||||
|
@ -387,7 +389,7 @@ export default {
|
||||||
payload = message.attachments.first();
|
payload = message.attachments.first();
|
||||||
}
|
}
|
||||||
|
|
||||||
args[arg.name] = payload;
|
args[payloadName] = payload;
|
||||||
}
|
}
|
||||||
await command.execute(message, args, client);
|
await command.execute(message, args, client);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue