From 38df7114f2324d00bfbd4099847e65176832a876 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 29 Dec 2022 17:37:59 +0300 Subject: [PATCH] Add Message.forum_topic_edited. --- telegram-bot-api/Client.cpp | 28 +++++++++++++++++++++++++--- telegram-bot-api/Client.h | 1 + 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index bf12e5d..0d94424 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -1402,6 +1402,27 @@ class Client::JsonForumTopicCreated final : public Jsonable { const td_api::messageForumTopicCreated *forum_topic_created_; }; +class Client::JsonForumTopicEdited final : public Jsonable { + public: + explicit JsonForumTopicEdited(const td_api::messageForumTopicEdited *forum_topic_edited) + : forum_topic_edited_(forum_topic_edited) { + } + void store(JsonValueScope *scope) const { + auto object = scope->enter_object(); + if (!forum_topic_edited_->name_.empty()) { + object("name", forum_topic_edited_->name_); + } + if (forum_topic_edited_->edit_icon_custom_emoji_id_) { + object("icon_custom_emoji_id", forum_topic_edited_->icon_custom_emoji_id_ == 0 + ? td::string() + : td::to_string(forum_topic_edited_->icon_custom_emoji_id_)); + } + } + + private: + const td_api::messageForumTopicEdited *forum_topic_edited_; +}; + class Client::JsonForumTopicIsClosedToggled final : public Jsonable { public: void store(JsonValueScope *scope) const { @@ -2049,8 +2070,11 @@ void Client::JsonMessage::store(JsonValueScope *scope) const { object("forum_topic_created", JsonForumTopicCreated(content)); break; } - case td_api::messageForumTopicEdited::ID: + case td_api::messageForumTopicEdited::ID: { + auto content = static_cast(message_->content.get()); + object("forum_topic_edited", JsonForumTopicEdited(content)); break; + } case td_api::messageForumTopicIsClosedToggled::ID: { auto content = static_cast(message_->content.get()); if (content->is_closed_) { @@ -10361,8 +10385,6 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr