Skip to content

Commit 3736edb

Browse files
Set command name when resolving
When a command is created the description is already a property of the command class. As a command can have many names (alias) it is not set in the command class itself. However sometimes there can be login INSIDE the command class than depends on the name of the command at runtime. This fix allows the command name to be set when it is resolved so that internal logic can use that name.
1 parent 0f6ce75 commit 3736edb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Console/Command/CommandRegisterCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function registerCommands(): void
5353
$botCommands = $handler->getCommands();
5454

5555
$commands = collect($botCommands)->map(static function ($command, $name) use ($handler): BotCommand {
56-
$command = $handler->getCommandBus()->resolveCommand($command);
56+
$command = $handler->getCommandBus()->resolveCommand($command)->setName($name);
5757

5858
return BotCommand::make([
5959
// Can contain only lowercase English letters, digits and underscores.

0 commit comments

Comments
 (0)