From bb81cf6842aa7938e9a35fe0ff3b02a3b1a9f926 Mon Sep 17 00:00:00 2001 From: Bsian Date: Fri, 1 Nov 2019 00:20:55 +0000 Subject: [PATCH] Last attempt --- src/class/Command.ts | 2 ++ src/class/Util.ts | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/class/Command.ts b/src/class/Command.ts index c19b7eb..e1caa2c 100644 --- a/src/class/Command.ts +++ b/src/class/Command.ts @@ -5,6 +5,8 @@ import { Collection } from '.'; export default class Command { name: string + parentName: string + description?: string usage?: string diff --git a/src/class/Util.ts b/src/class/Util.ts index a46d102..beb60f9 100644 --- a/src/class/Util.ts +++ b/src/class/Util.ts @@ -55,7 +55,7 @@ export default class Util { } if (!resolvedCommand) return Promise.resolve({ cmd: null, args }); - let label = `${command}`; + let parentLabel = `${command}`; let hasSubCommands = true; while (hasSubCommands) { if (!resolvedCommand.subcommands.size) { @@ -64,11 +64,11 @@ export default class Util { hasSubCommands = false; break; } else if (resolvedCommand.subcommands.has(args[0])) { resolvedCommand = resolvedCommand.subcommands.get(args[0]); - args.shift(); label += ` ${args[0]}`; + args.shift(); parentLabel += ` ${args[0]}`; } else { for (const subCmd of resolvedCommand.subcommands.toArray()) { if (subCmd.aliases.includes(args[0])) { - resolvedCommand = subCmd; args.shift(); label += ` ${args[0]}`; break; + resolvedCommand = subCmd; args.shift(); parentLabel += ` ${args[0]}`; break; } else { hasSubCommands = false; break; } @@ -76,7 +76,7 @@ export default class Util { } } const finalCommand = resolvedCommand; - finalCommand.name = label; + finalCommand.parentName = parentLabel; return Promise.resolve({ cmd: finalCommand, args }); } catch (error) {