diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 7b227db4d..8d98332d2 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -4677,27 +4677,6 @@ canSendStoryResultWeeklyLimitExceeded retry_after:int32 = CanSendStoryResult; canSendStoryResultMonthlyLimitExceeded retry_after:int32 = CanSendStoryResult; -//@class CanBoostChatResult @description Represents result of checking whether the current user can boost the specific chat - -//@description The chat can be boosted @currently_boosted_chat_id Identifier of the currently boosted chat from which boost will be removed; 0 if none -canBoostChatResultOk currently_boosted_chat_id:int53 = CanBoostChatResult; - -//@description The chat can't be boosted -canBoostChatResultInvalidChat = CanBoostChatResult; - -//@description The chat is already boosted by the user -canBoostChatResultAlreadyBoosted = CanBoostChatResult; - -//@description The user must subscribe to Telegram Premium to be able to boost chats -canBoostChatResultPremiumNeeded = CanBoostChatResult; - -//@description The user must have Telegram Premium subscription instead of a gifted Telegram Premium -canBoostChatResultPremiumSubscriptionNeeded = CanBoostChatResult; - -//@description The user must wait the specified time before the boost can be moved to another chat @retry_after Time left before the user can boost another chat -canBoostChatResultWaitNeeded retry_after:int32 = CanBoostChatResult; - - //@class CanTransferOwnershipResult @description Represents result of checking whether the current session can be used to transfer a chat ownership to another user //@description The session can be used @@ -7917,9 +7896,6 @@ activateStoryStealthMode = Ok; //@description Returns the current boost status for a channel chat @chat_id Identifier of the channel chat getChatBoostStatus chat_id:int53 = ChatBoostStatus; -//@description Checks whether the current user can boost a chat @chat_id Identifier of the chat -canBoostChat chat_id:int53 = CanBoostChatResult; - //@description Boosts a chat @chat_id Identifier of the chat boostChat chat_id:int53 = Ok; diff --git a/td/telegram/StoryManager.cpp b/td/telegram/StoryManager.cpp index 2ea0b78a4..cd6664894 100644 --- a/td/telegram/StoryManager.cpp +++ b/td/telegram/StoryManager.cpp @@ -813,26 +813,6 @@ class GetBoostsStatusQuery final : public Td::ResultHandler { } }; -class CanApplyBoostQuery final : public Td::ResultHandler { - Promise> promise_; - - public: - explicit CanApplyBoostQuery(Promise> &&promise) - : promise_(std::move(promise)) { - } - - void send(DialogId dialog_id) { - return on_error(Status::Error(400, "Unsupported")); - } - - void on_result(BufferSlice packet) final { - } - - void on_error(Status status) final { - promise_.set_error(std::move(status)); - } -}; - class ApplyBoostQuery final : public Td::ResultHandler { Promise promise_; DialogId dialog_id_; @@ -3024,40 +3004,6 @@ void StoryManager::get_dialog_boost_status(DialogId dialog_id, td_->create_handler(std::move(promise))->send(dialog_id); } -void StoryManager::can_boost_dialog(DialogId dialog_id, - Promise> &&promise) { - if (!td_->messages_manager_->have_dialog_force(dialog_id, "get_dialog_boost_status")) { - return promise.set_error(Status::Error(400, "Chat not found")); - } - if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Read)) { - return promise.set_error(Status::Error(400, "Can't access the chat")); - } - - td_->create_handler(std::move(promise))->send(dialog_id); -} - -td_api::object_ptr StoryManager::get_can_boost_chat_result_object( - const Status &error) const { - CHECK(error.is_error()); - if (error.message() == "PREMIUM_ACCOUNT_REQUIRED") { - return td_api::make_object(); - } - if (error.message() == "PREMIUM_GIFTED_NOT_ALLOWED") { - return td_api::make_object(); - } - if (error.message() == "BOOST_NOT_MODIFIED") { - return td_api::make_object(); - } - if (error.message() == "PEER_ID_INVALID") { - return td_api::make_object(); - } - auto retry_after = Global::get_retry_after(error.code(), error.message()); - if (retry_after > 0) { - return td_api::make_object(retry_after); - } - return nullptr; -} - void StoryManager::boost_dialog(DialogId dialog_id, Promise &&promise) { if (!td_->messages_manager_->have_dialog_force(dialog_id, "get_dialog_boost_status")) { return promise.set_error(Status::Error(400, "Chat not found")); diff --git a/td/telegram/StoryManager.h b/td/telegram/StoryManager.h index f797888df..bb6bd26dd 100644 --- a/td/telegram/StoryManager.h +++ b/td/telegram/StoryManager.h @@ -271,10 +271,6 @@ class StoryManager final : public Actor { void get_dialog_boost_status(DialogId dialog_id, Promise> &&promise); - void can_boost_dialog(DialogId dialog_id, Promise> &&promise); - - td_api::object_ptr get_can_boost_chat_result_object(const Status &error) const; - void boost_dialog(DialogId dialog_id, Promise &&promise); Result> get_dialog_boost_link(DialogId dialog_id); diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index bf996247f..fa4734738 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -6635,12 +6635,6 @@ void Td::on_request(uint64 id, const td_api::getChatBoostStatus &request) { story_manager_->get_dialog_boost_status(DialogId(request.chat_id_), std::move(promise)); } -void Td::on_request(uint64 id, const td_api::canBoostChat &request) { - CHECK_IS_USER(); - CREATE_REQUEST_PROMISE(); - story_manager_->can_boost_dialog(DialogId(request.chat_id_), std::move(promise)); -} - void Td::on_request(uint64 id, const td_api::boostChat &request) { CHECK_IS_USER(); CREATE_OK_REQUEST_PROMISE(); diff --git a/td/telegram/Td.h b/td/telegram/Td.h index ea99d67bf..cc5aac02a 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -1047,8 +1047,6 @@ class Td final : public Actor { void on_request(uint64 id, const td_api::getChatBoostStatus &request); - void on_request(uint64 id, const td_api::canBoostChat &request); - void on_request(uint64 id, const td_api::boostChat &request); void on_request(uint64 id, const td_api::getChatBoostLink &request); diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index 262fbd0c4..4e0e313a0 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -4371,10 +4371,6 @@ class CliClient final : public Actor { ChatId chat_id; get_args(args, chat_id); send_request(td_api::make_object(chat_id)); - } else if (op == "cbc") { - ChatId chat_id; - get_args(args, chat_id); - send_request(td_api::make_object(chat_id)); } else if (op == "bc") { ChatId chat_id; get_args(args, chat_id);