From 8446380ba4f24f2049b6252c2c19cf10a74fbfa3 Mon Sep 17 00:00:00 2001 From: twlite <46562212+twlite@users.noreply.github.com> Date: Sat, 11 Oct 2025 14:29:55 +0545 Subject: [PATCH 1/2] feat: add raw command name fetcher to context --- packages/commandkit/src/app/commands/Context.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/commandkit/src/app/commands/Context.ts b/packages/commandkit/src/app/commands/Context.ts index 1e3614b8..8b2bca8b 100644 --- a/packages/commandkit/src/app/commands/Context.ts +++ b/packages/commandkit/src/app/commands/Context.ts @@ -308,6 +308,17 @@ export class Context< return this.commandkit.commandHandler.resolveMessageCommandName(maybeAlias); } + /** + * Gets the invoked command name (could be an alias for message commands) + */ + public get invokedCommandName(): string { + if (this.isInteraction()) { + return this.interaction.commandName; + } + + return this.config.messageCommandParser!.getCommand(); + } + /** * Gets the command options based on the execution mode. */ From 230bf1e2f1b2473f39ccbd3cbb4c9c24a61392cb Mon Sep 17 00:00:00 2001 From: twlite <46562212+twlite@users.noreply.github.com> Date: Sat, 11 Oct 2025 14:30:17 +0545 Subject: [PATCH 2/2] docs: generate api docs --- .../docs/api-reference/commandkit/classes/context.mdx | 6 ++++++ .../api-reference/commandkit/classes/middleware-context.mdx | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/website/docs/api-reference/commandkit/classes/context.mdx b/apps/website/docs/api-reference/commandkit/classes/context.mdx index d553b701..a7281a68 100644 --- a/apps/website/docs/api-reference/commandkit/classes/context.mdx +++ b/apps/website/docs/api-reference/commandkit/classes/context.mdx @@ -31,6 +31,7 @@ class Context) store: void commandName: string + invokedCommandName: string options: CommandContextOptions forwarded: boolean forwardCommand(command: C) => Promise; @@ -110,6 +111,11 @@ This store is shared across all contexts in the same command execution, includin Gets the name of the current command. +### invokedCommandName + + + +Gets the invoked command name (could be an alias for message commands) ### options CommandContextOptions<ExecutionMode>`} /> diff --git a/apps/website/docs/api-reference/commandkit/classes/middleware-context.mdx b/apps/website/docs/api-reference/commandkit/classes/middleware-context.mdx index 049b8051..397124db 100644 --- a/apps/website/docs/api-reference/commandkit/classes/middleware-context.mdx +++ b/apps/website/docs/api-reference/commandkit/classes/middleware-context.mdx @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription'; ## MiddlewareContext - + Extended context class for middleware execution with additional control methods.