Add getChatBoosts.only_gift_codes.
This commit is contained in:
parent
8d25f6f1d9
commit
ac64cf9b45
@ -7933,9 +7933,10 @@ getChatBoostLinkInfo url:string = ChatBoostLinkInfo;
|
||||
|
||||
//@description Returns list of boosts applied to a chat. The user must be an administrator in the channel chat to get the list of boosts
|
||||
//@chat_id Identifier of the chat
|
||||
//@only_gift_codes Pass true to receive only boosts received from gift codes and giveaways created by the chat
|
||||
//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
|
||||
//@limit The maximum number of boosts to be returned; up to 100. For optimal performance, the number of returned boosts can be smaller than the specified limit
|
||||
getChatBoosts chat_id:int53 offset:string limit:int32 = FoundChatBoosts;
|
||||
getChatBoosts chat_id:int53 only_gift_codes:Bool offset:string limit:int32 = FoundChatBoosts;
|
||||
|
||||
|
||||
//@description Returns information about a bot that can be added to attachment or side menu @bot_user_id Bot's user identifier
|
||||
|
@ -127,10 +127,14 @@ class GetBoostsListQuery final : public Td::ResultHandler {
|
||||
: promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(DialogId dialog_id, const string &offset, int32 limit) {
|
||||
void send(DialogId dialog_id, bool only_gift_codes, const string &offset, int32 limit) {
|
||||
dialog_id_ = dialog_id;
|
||||
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id_, AccessRights::Read);
|
||||
CHECK(input_peer != nullptr);
|
||||
int32 flags = 0;
|
||||
if (only_gift_codes) {
|
||||
flags |= telegram_api::premium_getBoostsList::GIFTS_MASK;
|
||||
}
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::premium_getBoostsList(0, false /*ignored*/, std::move(input_peer), offset, limit)));
|
||||
}
|
||||
@ -279,7 +283,7 @@ td_api::object_ptr<td_api::chatBoostLinkInfo> BoostManager::get_chat_boost_link_
|
||||
is_public, td_->messages_manager_->get_chat_id_object(dialog_id, "chatBoostLinkInfo"));
|
||||
}
|
||||
|
||||
void BoostManager::get_dialog_boosts(DialogId dialog_id, const string &offset, int32 limit,
|
||||
void BoostManager::get_dialog_boosts(DialogId dialog_id, bool only_gift_codes, const string &offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::foundChatBoosts>> &&promise) {
|
||||
if (!td_->messages_manager_->have_dialog_force(dialog_id, "get_dialog_boost_status")) {
|
||||
return promise.set_error(Status::Error(400, "Chat not found"));
|
||||
@ -291,7 +295,7 @@ void BoostManager::get_dialog_boosts(DialogId dialog_id, const string &offset, i
|
||||
return promise.set_error(Status::Error(400, "Parameter limit must be positive"));
|
||||
}
|
||||
|
||||
td_->create_handler<GetBoostsListQuery>(std::move(promise))->send(dialog_id, offset, limit);
|
||||
td_->create_handler<GetBoostsListQuery>(std::move(promise))->send(dialog_id, only_gift_codes, offset, limit);
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -34,7 +34,7 @@ class BoostManager final : public Actor {
|
||||
|
||||
td_api::object_ptr<td_api::chatBoostLinkInfo> get_chat_boost_link_info_object(const DialogBoostLinkInfo &info) const;
|
||||
|
||||
void get_dialog_boosts(DialogId dialog_id, const string &offset, int32 limit,
|
||||
void get_dialog_boosts(DialogId dialog_id, bool only_gift_codes, const string &offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::foundChatBoosts>> &&promise);
|
||||
|
||||
private:
|
||||
|
@ -6668,7 +6668,8 @@ void Td::on_request(uint64 id, td_api::getChatBoosts &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.offset_);
|
||||
CREATE_REQUEST_PROMISE();
|
||||
boost_manager_->get_dialog_boosts(DialogId(request.chat_id_), request.offset_, request.limit_, std::move(promise));
|
||||
boost_manager_->get_dialog_boosts(DialogId(request.chat_id_), request.only_gift_codes_, request.offset_,
|
||||
request.limit_, std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::getAttachmentMenuBot &request) {
|
||||
|
@ -4383,10 +4383,11 @@ class CliClient final : public Actor {
|
||||
send_request(td_api::make_object<td_api::getChatBoostLinkInfo>(args));
|
||||
} else if (op == "gcb") {
|
||||
ChatId chat_id;
|
||||
bool only_gift_codes;
|
||||
string offset;
|
||||
string limit;
|
||||
get_args(args, chat_id);
|
||||
send_request(td_api::make_object<td_api::getChatBoosts>(chat_id, offset, as_limit(limit)));
|
||||
get_args(args, chat_id, only_gift_codes, offset, limit);
|
||||
send_request(td_api::make_object<td_api::getChatBoosts>(chat_id, only_gift_codes, offset, as_limit(limit)));
|
||||
} else if (op == "gamb") {
|
||||
UserId user_id;
|
||||
get_args(args, user_id);
|
||||
|
Loading…
Reference in New Issue
Block a user