From 8936f9b639eb8db9663dc3e54793fc685b69ac15 Mon Sep 17 00:00:00 2001 From: Jack'lul Date: Sun, 29 Oct 2023 21:28:14 +0100 Subject: [PATCH] Show error when message edit fails --- src/Command/Admin/StatsCommand.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Command/Admin/StatsCommand.php b/src/Command/Admin/StatsCommand.php index 86fce4e..bcc3460 100644 --- a/src/Command/Admin/StatsCommand.php +++ b/src/Command/Admin/StatsCommand.php @@ -126,7 +126,12 @@ public function execute(): ServerResponse return Request::sendMessage($data); } elseif ($callback_query) { $data['message_id'] = $callback_query->getMessage()->getMessageId(); - Request::editMessageText($data); + $result = Request::editMessageText($data); + + if (!$result->isOk()) { + $data_query['show_alert'] = true; + $data_query['text'] = substr($result->getDescription(), 0, 200); + } return Request::answerCallbackQuery($data_query); }