File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
packages/commandkit/src/app Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -302,9 +302,10 @@ export class Context<
302302 public get commandName ( ) : string {
303303 if ( this . isInteraction ( ) ) {
304304 return this . interaction . commandName ;
305- } else {
306- return this . config . messageCommandParser ! . getCommand ( ) ;
307305 }
306+
307+ const maybeAlias = this . config . messageCommandParser ! . getCommand ( ) ;
308+ return this . commandkit . commandHandler . resolveMessageCommandName ( maybeAlias ) ;
308309 }
309310
310311 /**
Original file line number Diff line number Diff line change 11import {
2- ApplicationCommandType ,
32 AutocompleteInteraction ,
43 Awaitable ,
54 Collection ,
@@ -648,6 +647,22 @@ export class AppCommandHandler {
648647 return null ;
649648 }
650649
650+ public resolveMessageCommandName ( name : string ) : string {
651+ for ( const [ , loadedCommand ] of this . loadedCommands ) {
652+ if ( loadedCommand . data . command . name === name ) {
653+ return loadedCommand . data . command . name ;
654+ }
655+
656+ const aliases = loadedCommand . data . metadata ?. aliases ;
657+
658+ if ( aliases && Array . isArray ( aliases ) && aliases . includes ( name ) ) {
659+ return loadedCommand . data . command . name ;
660+ }
661+ }
662+
663+ return name ;
664+ }
665+
651666 /**
652667 * Reloads all commands and middleware from scratch.
653668 */
You can’t perform that action at this time.
0 commit comments