Remove td_api::canBoostChat.

This commit is contained in:
levlam 2023-10-19 15:46:09 +03:00
parent edc3e4c18a
commit 81bdd4294b
6 changed files with 0 additions and 94 deletions

View File

@ -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;

View File

@ -813,26 +813,6 @@ class GetBoostsStatusQuery final : public Td::ResultHandler {
}
};
class CanApplyBoostQuery final : public Td::ResultHandler {
Promise<td_api::object_ptr<td_api::CanBoostChatResult>> promise_;
public:
explicit CanApplyBoostQuery(Promise<td_api::object_ptr<td_api::CanBoostChatResult>> &&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<Unit> promise_;
DialogId dialog_id_;
@ -3024,40 +3004,6 @@ void StoryManager::get_dialog_boost_status(DialogId dialog_id,
td_->create_handler<GetBoostsStatusQuery>(std::move(promise))->send(dialog_id);
}
void StoryManager::can_boost_dialog(DialogId dialog_id,
Promise<td_api::object_ptr<td_api::CanBoostChatResult>> &&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<CanApplyBoostQuery>(std::move(promise))->send(dialog_id);
}
td_api::object_ptr<td_api::CanBoostChatResult> 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<td_api::canBoostChatResultPremiumNeeded>();
}
if (error.message() == "PREMIUM_GIFTED_NOT_ALLOWED") {
return td_api::make_object<td_api::canBoostChatResultPremiumSubscriptionNeeded>();
}
if (error.message() == "BOOST_NOT_MODIFIED") {
return td_api::make_object<td_api::canBoostChatResultAlreadyBoosted>();
}
if (error.message() == "PEER_ID_INVALID") {
return td_api::make_object<td_api::canBoostChatResultInvalidChat>();
}
auto retry_after = Global::get_retry_after(error.code(), error.message());
if (retry_after > 0) {
return td_api::make_object<td_api::canBoostChatResultWaitNeeded>(retry_after);
}
return nullptr;
}
void StoryManager::boost_dialog(DialogId dialog_id, Promise<Unit> &&promise) {
if (!td_->messages_manager_->have_dialog_force(dialog_id, "get_dialog_boost_status")) {
return promise.set_error(Status::Error(400, "Chat not found"));

View File

@ -271,10 +271,6 @@ class StoryManager final : public Actor {
void get_dialog_boost_status(DialogId dialog_id, Promise<td_api::object_ptr<td_api::chatBoostStatus>> &&promise);
void can_boost_dialog(DialogId dialog_id, Promise<td_api::object_ptr<td_api::CanBoostChatResult>> &&promise);
td_api::object_ptr<td_api::CanBoostChatResult> get_can_boost_chat_result_object(const Status &error) const;
void boost_dialog(DialogId dialog_id, Promise<Unit> &&promise);
Result<std::pair<string, bool>> get_dialog_boost_link(DialogId dialog_id);

View File

@ -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();

View File

@ -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);

View File

@ -4371,10 +4371,6 @@ class CliClient final : public Actor {
ChatId chat_id;
get_args(args, chat_id);
send_request(td_api::make_object<td_api::getChatBoostStatus>(chat_id));
} else if (op == "cbc") {
ChatId chat_id;
get_args(args, chat_id);
send_request(td_api::make_object<td_api::canBoostChat>(chat_id));
} else if (op == "bc") {
ChatId chat_id;
get_args(args, chat_id);