From 83a49569abfc9d6c829ae3270606d25c1815dfb5 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 4 Dec 2023 15:32:17 +0300 Subject: [PATCH] Store identifier of inaccessible pinned message. --- telegram-bot-api/Client.cpp | 12 ++++-------- telegram-bot-api/Client.h | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 466383f..c142f6d 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -896,9 +896,9 @@ class Client::JsonChat final : public td::Jsonable { int64 pinned_message_id_; }; -class Client::JsonDeletedMessage final : public td::Jsonable { +class Client::JsonInaccessibleMessage final : public td::Jsonable { public: - JsonDeletedMessage(int64 chat_id, int64 message_id, const Client *client) + JsonInaccessibleMessage(int64 chat_id, int64 message_id, const Client *client) : chat_id_(chat_id), message_id_(message_id), client_(client) { } void store(td::JsonValueScope *scope) const { @@ -2557,6 +2557,7 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const { object("pinned_message", JsonMessage(pinned_message, false, "pin in " + source_, client_)); } else if (need_reply_) { LOG(INFO) << "Pinned unknown, inaccessible or deleted message " << message_id; + object("pinned_message", JsonInaccessibleMessage(message_->chat_id, message_id, client_)); } } break; @@ -2838,7 +2839,7 @@ class Client::JsonCallbackQuery final : public td::Jsonable { if (message_info_ != nullptr) { object("message", JsonMessage(message_info_, true, "callback query", client_)); } else { - object("message", JsonDeletedMessage(chat_id_, message_id_, client_)); + object("message", JsonInaccessibleMessage(chat_id_, message_id_, client_)); } object("chat_instance", td::to_string(chat_instance_)); client_->json_store_callback_query_payload(object, payload_); @@ -11745,11 +11746,6 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr