diff --git a/src/TgBotLib/PollingBot.php b/src/TgBotLib/PollingBot.php index df35eab..f3e93fc 100644 --- a/src/TgBotLib/PollingBot.php +++ b/src/TgBotLib/PollingBot.php @@ -237,8 +237,7 @@ $command = $update?->getAnyMessage()?->getCommand(); if ($command !== null) { - $commandHandlers = $this->getEventHandlersByCommand($command); - foreach ($commandHandlers as $commandHandler) + foreach ($this->getEventHandlersByCommand($command) as $commandHandler) { (new $commandHandler($update))->handle($this); }