diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 2a57f7207..770b40069 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -3512,7 +3512,7 @@ prepaidPremiumGiveaway id:int64 user_count:int32 month_count:int32 payment_date: //@description Describes current boost status of a chat //@boost_url An HTTP URL, which can be used to boost the chat -//@applied_slots Identifiers of boost slots of the current user applied to the chat +//@applied_slot_ids Identifiers of boost slots of the current user applied to the chat //@level Current boost level of the chat //@gift_code_boost_count The number of boosts received by the chat from created Telegram Premium gift codes and giveaways //@boost_count The number of boosts received by the chat @@ -3521,7 +3521,7 @@ prepaidPremiumGiveaway id:int64 user_count:int32 month_count:int32 payment_date: //@premium_member_count Approximate number of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat //@premium_member_percentage A percentage of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat //@prepaid_giveaways The list of prepaid giveaways available for the chat; only for chat administrators -chatBoostStatus boost_url:string applied_slots:vector level:int32 gift_code_boost_count:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double prepaid_giveaways:vector = ChatBoostStatus; +chatBoostStatus boost_url:string applied_slot_ids:vector level:int32 gift_code_boost_count:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double prepaid_giveaways:vector = ChatBoostStatus; //@description Describes a boost of a chat //@count The number of boosts applied @@ -7923,8 +7923,8 @@ 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 Boosts a chat @chat_id Identifier of the chat -boostChat chat_id:int53 = Ok; +//@description Boosts a chat @chat_id Identifier of the chat @slot_ids Identifiers of boost slots of the current user from which to apply boosts to the chat +boostChat chat_id:int53 slot_ids:vector = Ok; //@description Returns an HTTPS link to boost the specified channel chat @chat_id Identifier of the chat getChatBoostLink chat_id:int53 = ChatBoostLink; diff --git a/td/telegram/BoostManager.cpp b/td/telegram/BoostManager.cpp index 9fcbd197c..1a1a4dab7 100644 --- a/td/telegram/BoostManager.cpp +++ b/td/telegram/BoostManager.cpp @@ -99,12 +99,14 @@ class ApplyBoostQuery final : public Td::ResultHandler { explicit ApplyBoostQuery(Promise &&promise) : promise_(std::move(promise)) { } - void send(DialogId dialog_id) { + void send(DialogId dialog_id, vector slot_ids) { dialog_id_ = dialog_id; auto input_peer = td_->messages_manager_->get_input_peer(dialog_id_, AccessRights::Read); CHECK(input_peer != nullptr); - send_query(G()->net_query_creator().create( - telegram_api::premium_applyBoost(0, vector(), std::move(input_peer)), {{dialog_id}})); + send_query( + G()->net_query_creator().create(telegram_api::premium_applyBoost(telegram_api::premium_applyBoost::SLOTS_MASK, + std::move(slot_ids), std::move(input_peer)), + {{dialog_id}})); } void on_result(BufferSlice packet) final { @@ -226,15 +228,18 @@ void BoostManager::get_dialog_boost_status(DialogId dialog_id, td_->create_handler(std::move(promise))->send(dialog_id); } -void BoostManager::boost_dialog(DialogId dialog_id, Promise &&promise) { +void BoostManager::boost_dialog(DialogId dialog_id, vector slot_ids, 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")); } + if (slot_ids.empty()) { + return promise.set_value(Unit()); + } - td_->create_handler(std::move(promise))->send(dialog_id); + td_->create_handler(std::move(promise))->send(dialog_id, slot_ids); } Result> BoostManager::get_dialog_boost_link(DialogId dialog_id) { diff --git a/td/telegram/BoostManager.h b/td/telegram/BoostManager.h index 9f02e5e5d..7afb90057 100644 --- a/td/telegram/BoostManager.h +++ b/td/telegram/BoostManager.h @@ -26,7 +26,7 @@ class BoostManager final : public Actor { void get_dialog_boost_status(DialogId dialog_id, Promise> &&promise); - void boost_dialog(DialogId dialog_id, Promise &&promise); + void boost_dialog(DialogId dialog_id, vector slot_ids, Promise &&promise); Result> get_dialog_boost_link(DialogId dialog_id); diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 853caada8..b71891453 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -6646,7 +6646,7 @@ void Td::on_request(uint64 id, const td_api::getChatBoostStatus &request) { void Td::on_request(uint64 id, const td_api::boostChat &request) { CHECK_IS_USER(); CREATE_OK_REQUEST_PROMISE(); - boost_manager_->boost_dialog(DialogId(request.chat_id_), std::move(promise)); + boost_manager_->boost_dialog(DialogId(request.chat_id_), std::move(request.slot_ids_), std::move(promise)); } void Td::on_request(uint64 id, const td_api::getChatBoostLink &request) { diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index cd66cfcf3..b91277fd6 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -4373,8 +4373,9 @@ class CliClient final : public Actor { send_request(td_api::make_object(chat_id)); } else if (op == "bc") { ChatId chat_id; - get_args(args, chat_id); - send_request(td_api::make_object(chat_id)); + string slot_ids; + get_args(args, chat_id, slot_ids); + send_request(td_api::make_object(chat_id, to_integers(slot_ids))); } else if (op == "gcbl") { ChatId chat_id; get_args(args, chat_id);