From 3143e478cd11d89fb2c06cdc75693d0a2b913f7a Mon Sep 17 00:00:00 2001 From: Supositware Date: Wed, 14 Sep 2022 11:31:43 +0200 Subject: [PATCH] Finally(?) fix command flags --- events/client/messageCreate.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/events/client/messageCreate.js b/events/client/messageCreate.js index 65a347e7..6ee08327 100644 --- a/events/client/messageCreate.js +++ b/events/client/messageCreate.js @@ -370,15 +370,17 @@ export default { }; 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; - const arg = command.data.options[i]; + const arg = command.data.options[j]; const type = arg.constructor.name.toLowerCase(); + let payloadName = arg.name; let payload = messageArgs[i]; - if (payload.startsWith('--')) { - arg.name = payload.substring(2); + if (messageArgs[i].startsWith('--')) { + payloadName = payload.substring(2); payload = true; + j--; } else if (type.includes('mentionable')) { payload = message.mentions.members.first(); @@ -387,7 +389,7 @@ export default { payload = message.attachments.first(); } - args[arg.name] = payload; + args[payloadName] = payload; } await command.execute(message, args, client); }