From e5e9a6fd28a365f3e38412ff1abb73437a059da7 Mon Sep 17 00:00:00 2001 From: Anton Date: Mon, 25 Sep 2023 21:27:21 +0800 Subject: [PATCH] Texts and small fixes for setcommands command --- src/TelegramBot/Command/ButtonSetCommandsCommand.php | 4 ++-- src/TelegramBot/CommandMetadataProvider.php | 9 +++------ src/TelegramBot/LongPollingService.php | 1 + 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/TelegramBot/Command/ButtonSetCommandsCommand.php b/src/TelegramBot/Command/ButtonSetCommandsCommand.php index 5d44ad2..80da79b 100644 --- a/src/TelegramBot/Command/ButtonSetCommandsCommand.php +++ b/src/TelegramBot/Command/ButtonSetCommandsCommand.php @@ -49,7 +49,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if ($commands === []) { - $io->warning('Could not find publish commands'); + $io->warning('Could not find any commands to publish'); return Command::SUCCESS; } @@ -67,7 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::FAILURE; } - $io->success('Bot\'s menu button set'); + $io->success('Bot\'s menu button has been set'); return Command::SUCCESS; } diff --git a/src/TelegramBot/CommandMetadataProvider.php b/src/TelegramBot/CommandMetadataProvider.php index c3193a5..f681d61 100644 --- a/src/TelegramBot/CommandMetadataProvider.php +++ b/src/TelegramBot/CommandMetadataProvider.php @@ -14,19 +14,16 @@ public function __construct( } /** - * @return list + * @return \Generator */ - public function gelMetadataList(): array + public function gelMetadataList(): \Generator { - $list = []; foreach ($this->controllersMap as ['controller' => $controller]) { $command = $this->instantiateAttribute($controller); if ($command !== null) { - $list[] = $command; + yield $command; } } - - return $list; } /** diff --git a/src/TelegramBot/LongPollingService.php b/src/TelegramBot/LongPollingService.php index b29f829..170116d 100644 --- a/src/TelegramBot/LongPollingService.php +++ b/src/TelegramBot/LongPollingService.php @@ -12,6 +12,7 @@ final class LongPollingService { private const LIMIT = 50; + private int $timeout = 15; private int $offset = 0;