From 82ec9dc608b8198695e5a75edf010dd8bab13e8b Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 31 Oct 2022 19:11:29 +0300 Subject: [PATCH] Add closeTopicForum method. --- telegram-bot-api/Client.cpp | 13 +++++++++++++ telegram-bot-api/Client.h | 1 + 2 files changed, 14 insertions(+) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 64b0e42..d3c6e7a 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -256,6 +256,7 @@ bool Client::init_methods() { methods_.emplace("getforumtopiciconstickers", &Client::process_get_forum_topic_icon_stickers_query); methods_.emplace("createforumtopic", &Client::process_create_forum_topic_query); methods_.emplace("editforumtopic", &Client::process_edit_forum_topic_query); + methods_.emplace("closeforumtopic", &Client::process_close_forum_topic_query); methods_.emplace("getchatmember", &Client::process_get_chat_member_query); methods_.emplace("getchatadministrators", &Client::process_get_chat_administrators_query); methods_.emplace("getchatmembercount", &Client::process_get_chat_member_count_query); @@ -8180,6 +8181,18 @@ td::Status Client::process_edit_forum_topic_query(PromisedQueryPtr &query) { return Status::OK(); } +td::Status Client::process_close_forum_topic_query(PromisedQueryPtr &query) { + auto chat_id = query->arg("chat_id"); + auto message_thread_id = get_message_id(query.get(), "message_thread_id"); + + check_chat(chat_id, AccessRights::Write, std::move(query), + [this, message_thread_id](int64 chat_id, PromisedQueryPtr query) { + send_request(make_object(chat_id, message_thread_id, true), + td::make_unique(std::move(query))); + }); + return Status::OK(); +} + td::Status Client::process_get_chat_member_query(PromisedQueryPtr &query) { auto chat_id = query->arg("chat_id"); TRY_RESULT(user_id, get_user_id(query.get())); diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h index e3a1c33..1278189 100644 --- a/telegram-bot-api/Client.h +++ b/telegram-bot-api/Client.h @@ -541,6 +541,7 @@ class Client final : public WebhookActor::Callback { Status process_get_forum_topic_icon_stickers_query(PromisedQueryPtr &query); Status process_create_forum_topic_query(PromisedQueryPtr &query); Status process_edit_forum_topic_query(PromisedQueryPtr &query); + Status process_close_forum_topic_query(PromisedQueryPtr &query); Status process_get_chat_member_query(PromisedQueryPtr &query); Status process_get_chat_administrators_query(PromisedQueryPtr &query); Status process_get_chat_member_count_query(PromisedQueryPtr &query);