From f74c23b527ad9cd9c41152d3c8eb2053a59b42c2 Mon Sep 17 00:00:00 2001 From: rsgrinko Date: Fri, 15 Jul 2022 17:59:40 +0300 Subject: [PATCH] =?UTF-8?q?[*]=20=D0=BA=D0=BE=D0=BC=D0=B1=D0=B8=D0=BD?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=D0=B9=20=D0=BA?= =?UTF-8?q?=D0=BB=D0=B0=D1=81=D1=81=20=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20=D1=82=D0=B5=D0=BB=D0=B5?= =?UTF-8?q?=D0=B3=D1=80=D0=B0=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Core/ExternalServices/Telegram.class.php | 4 ++-- .../Core/ExternalServices/Telegram2.class.php | 18 ++++++++++++++++++ telegramHandler.php | 5 ++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/core/lib/Core/ExternalServices/Telegram.class.php b/core/lib/Core/ExternalServices/Telegram.class.php index 9042971..7dc0cb4 100644 --- a/core/lib/Core/ExternalServices/Telegram.class.php +++ b/core/lib/Core/ExternalServices/Telegram.class.php @@ -172,8 +172,8 @@ /** * Изменяет уже отправленное сообщение на указанное * - * @param $chatId - * @param $messageId + * @param int $chatId + * @param int $messageId * @param string $text * * @return array diff --git a/core/lib/Core/ExternalServices/Telegram2.class.php b/core/lib/Core/ExternalServices/Telegram2.class.php index e52ba72..b3a4759 100644 --- a/core/lib/Core/ExternalServices/Telegram2.class.php +++ b/core/lib/Core/ExternalServices/Telegram2.class.php @@ -136,6 +136,24 @@ return $text; } + /** + * Изменяет уже отправленное сообщение на указанное + * + * @param int $messageId + * @param string $text + * + * @return array + */ + public function updateMessage(int $messageId, string $text): array + { + $response = [ + 'chat_id' => $this->chatId, + 'message_id' => $messageId, + 'text' => $text, + ]; + return $this->setMethod('editMessageText')->sendRequest($response); + } + /** * Отправка изображения * diff --git a/telegramHandler.php b/telegramHandler.php index 1214740..3c4c8b4 100644 --- a/telegramHandler.php +++ b/telegramHandler.php @@ -15,8 +15,7 @@ $tg = new Telegram2(TELEGRAM_BOT_TOKEN); $tg->setRemoteRequest($data); - $tg->setChat(TELEGRAM_ADMIN_CHAT_ID)->sendMessage(print_r($tg->getChat('bitrix'), true)); - //$tg->setChat(TELEGRAM_ADMIN_CHAT_ID)->sendLocation( '54.007143', '38.046204'); + $res = $tg->setChat(TELEGRAM_ADMIN_CHAT_ID)->updateMessage(121, ''); - // sendTelegram(print_r($data, true)); \ No newline at end of file + sendTelegram(print_r($res, true)); \ No newline at end of file