Refactor command handler invocation in PollingBot

This commit is contained in:
netkas 2024-11-04 01:20:06 -05:00
parent 42c3138d3b
commit a4af8fd1b7

View file

@ -237,8 +237,7 @@
$command = $update?->getAnyMessage()?->getCommand(); $command = $update?->getAnyMessage()?->getCommand();
if ($command !== null) if ($command !== null)
{ {
$commandHandlers = $this->getEventHandlersByCommand($command); foreach ($this->getEventHandlersByCommand($command) as $commandHandler)
foreach ($commandHandlers as $commandHandler)
{ {
(new $commandHandler($update))->handle($this); (new $commandHandler($update))->handle($this);
} }