Allow to pass list of slots to boostChat.
This commit is contained in:
parent
00ac941e64
commit
de3aebd011
@ -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<int32> 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<prepaidPremiumGiveaway> = ChatBoostStatus;
|
||||
chatBoostStatus boost_url:string applied_slot_ids:vector<int32> 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<prepaidPremiumGiveaway> = 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<int32> = Ok;
|
||||
|
||||
//@description Returns an HTTPS link to boost the specified channel chat @chat_id Identifier of the chat
|
||||
getChatBoostLink chat_id:int53 = ChatBoostLink;
|
||||
|
@ -99,12 +99,14 @@ class ApplyBoostQuery final : public Td::ResultHandler {
|
||||
explicit ApplyBoostQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(DialogId dialog_id) {
|
||||
void send(DialogId dialog_id, vector<int32> 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<int>(), 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<GetBoostsStatusQuery>(std::move(promise))->send(dialog_id);
|
||||
}
|
||||
|
||||
void BoostManager::boost_dialog(DialogId dialog_id, Promise<Unit> &&promise) {
|
||||
void BoostManager::boost_dialog(DialogId dialog_id, vector<int32> slot_ids, 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"));
|
||||
}
|
||||
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<ApplyBoostQuery>(std::move(promise))->send(dialog_id);
|
||||
td_->create_handler<ApplyBoostQuery>(std::move(promise))->send(dialog_id, slot_ids);
|
||||
}
|
||||
|
||||
Result<std::pair<string, bool>> BoostManager::get_dialog_boost_link(DialogId dialog_id) {
|
||||
|
@ -26,7 +26,7 @@ class BoostManager final : public Actor {
|
||||
|
||||
void get_dialog_boost_status(DialogId dialog_id, Promise<td_api::object_ptr<td_api::chatBoostStatus>> &&promise);
|
||||
|
||||
void boost_dialog(DialogId dialog_id, Promise<Unit> &&promise);
|
||||
void boost_dialog(DialogId dialog_id, vector<int32> slot_ids, Promise<Unit> &&promise);
|
||||
|
||||
Result<std::pair<string, bool>> get_dialog_boost_link(DialogId dialog_id);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -4373,8 +4373,9 @@ class CliClient final : public Actor {
|
||||
send_request(td_api::make_object<td_api::getChatBoostStatus>(chat_id));
|
||||
} else if (op == "bc") {
|
||||
ChatId chat_id;
|
||||
get_args(args, chat_id);
|
||||
send_request(td_api::make_object<td_api::boostChat>(chat_id));
|
||||
string slot_ids;
|
||||
get_args(args, chat_id, slot_ids);
|
||||
send_request(td_api::make_object<td_api::boostChat>(chat_id, to_integers<int32>(slot_ids)));
|
||||
} else if (op == "gcbl") {
|
||||
ChatId chat_id;
|
||||
get_args(args, chat_id);
|
||||
|
Loading…
Reference in New Issue
Block a user