From 832be45a7a23328d4f2739e98edf5c46eb911d2c Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Sat, 21 Jun 2025 21:13:09 +0800 Subject: [PATCH] =?UTF-8?q?=D0=91=D0=BE=D1=82:=20=D0=BE=D1=82=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B0=20=D1=81=D0=BE=D0=B1=D1=8B=D1=82=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=BF=D0=B5=D1=87=D0=B0=D1=82=D0=B8=20=D1=82=D0=BE?= =?UTF-8?q?=D0=BB=D1=8C=D0=BA=D0=BE=20=D0=BF=D1=80=D0=B8=20=D0=BE=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA=D0=B5=20=D0=B8=D0=B7=D0=B2?= =?UTF-8?q?=D0=B5=D1=81=D1=82=D0=BD=D1=8B=D1=85=20=D0=BA=D0=BE=D0=BC=D0=B0?= =?UTF-8?q?=D0=BD=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Core/Bot.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/Core/Bot.php b/app/Core/Bot.php index 3f4593c..eba626f 100644 --- a/app/Core/Bot.php +++ b/app/Core/Bot.php @@ -72,7 +72,6 @@ class Bot */ public function process(): bool { - $this->bot->sendChatAction($this->update->getMessage()->getChat()->getId(), 'typing'); $commandText = $this->getBotCommandText(); return match (true) { str_starts_with($commandText, '/start') => $this->processHelpCommand(), @@ -90,9 +89,13 @@ class Bot * * @return bool * @throws InvalidArgumentException + * @throws \TelegramBot\Api\Exception + * @throws Exception */ protected function processListCommand(): bool { + $this->bot->sendChatAction($this->update->getMessage()->getChat()->getId(), 'typing'); + $playlists = ini()->getPlaylists(); if (empty($playlists)) { $replyText = 'Плейлистов нет'; @@ -132,9 +135,12 @@ class Bot * * @return bool * @throws InvalidArgumentException + * @throws \TelegramBot\Api\Exception */ protected function processInfoCommand(): bool { + $this->bot->sendChatAction($this->update->getMessage()->getChat()->getId(), 'typing'); + $message = $this->update->getMessage(); $text = $message->getText(); $command = $this->getBotCommand(); @@ -225,9 +231,12 @@ class Bot * Обрабатывает команду /help * * @return bool + * @throws \TelegramBot\Api\Exception */ protected function processHelpCommand(): bool { + $this->bot->sendChatAction($this->update->getMessage()->getChat()->getId(), 'typing'); + $replyText[] = 'Бот предоставляет короткую сводку о плейлистах, которые видны на сайте ' . $this->escape(base_url()) . '\.'; $replyText[] = 'Плейлисты проверяются сервером автоматически\.'; @@ -250,9 +259,12 @@ class Bot * Обрабатывает команду /links * * @return bool + * @throws \TelegramBot\Api\Exception */ protected function processLinksCommand(): bool { + $this->bot->sendChatAction($this->update->getMessage()->getChat()->getId(), 'typing'); + $replyText[] = '*Ресурсы и страницы*'; $replyText[] = ''; $replyText[] = '🌏 Сайт: ' . $this->escape(base_url()); @@ -275,6 +287,8 @@ class Bot */ protected function processStatsCommand(): bool { + $this->bot->sendChatAction($this->update->getMessage()->getChat()->getId(), 'typing'); + $allChannels = []; foreach (ini()->getPlaylists() as $pls) { $allChannels = array_merge($allChannels, $pls['channels'] ?? []);