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