From a4af8fd1b7b8da55fc36a1e21118d517a78addba Mon Sep 17 00:00:00 2001 From: netkas Date: Mon, 4 Nov 2024 01:20:06 -0500 Subject: [PATCH] Refactor command handler invocation in PollingBot --- src/TgBotLib/PollingBot.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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); }