Add td_api::chatBoostFeatures.

This commit is contained in:
levlam 2023-12-26 20:31:53 +03:00
parent 54bd830f49
commit 65903180a4
6 changed files with 26 additions and 0 deletions

View File

@ -3650,6 +3650,9 @@ publicForwards total_count:int32 forwards:vector<PublicForward> next_offset:stri
//@can_set_custom_background True, if custom background can be set in the chat for all users
chatBoostLevelFeatures level:int32 story_per_day_count:int32 custom_emoji_reaction_count:int32 title_color_count:int32 profile_accent_color_count:int32 can_set_profile_background_custom_emoji:Bool accent_color_count:int32 can_set_background_custom_emoji:Bool can_set_emoji_status:Bool chat_theme_background_count:int32 can_set_custom_background:Bool = ChatBoostLevelFeatures;
//@description Contains list of features available on the first chat boost levels @features The list of features
chatBoostFeatures features:vector<chatBoostLevelFeatures> = ChatBoostFeatures;
//@class ChatBoostSource @description Describes source of a chat boost
@ -8270,6 +8273,9 @@ getStoryPublicForwards story_sender_chat_id:int53 story_id:int32 offset:string l
//@description Returns list of features available on the specific chat boost level; this is an offline request @level Chat boost level
getChatBoostLevelFeatures level:int32 = ChatBoostLevelFeatures;
//@description Returns list of features available on the first 10 chat boost levels; this is an offline request
getChatBoostFeatures = ChatBoostFeatures;
//@description Returns the list of available chat boost slots for the current user
getAvailableChatBoostSlots = ChatBoostSlots;

View File

@ -361,6 +361,14 @@ td_api::object_ptr<td_api::chatBoostLevelFeatures> BoostManager::get_chat_boost_
can_set_emoji_status, theme_counts.chat_theme_count_, can_set_custom_background);
}
td_api::object_ptr<td_api::chatBoostFeatures> BoostManager::get_chat_boost_features_object() const {
vector<td_api::object_ptr<td_api::chatBoostLevelFeatures>> features;
for (int32 level = 1; level <= 10; level++) {
features.push_back(get_chat_boost_level_features_object(level));
}
return td_api::make_object<td_api::chatBoostFeatures>(std::move(features));
}
void BoostManager::get_boost_slots(Promise<td_api::object_ptr<td_api::chatBoostSlots>> &&promise) {
td_->create_handler<GetMyBoostsQuery>(std::move(promise))->send();
}

View File

@ -31,6 +31,8 @@ class BoostManager final : public Actor {
td_api::object_ptr<td_api::chatBoostLevelFeatures> get_chat_boost_level_features_object(int32 level) const;
td_api::object_ptr<td_api::chatBoostFeatures> get_chat_boost_features_object() const;
void get_boost_slots(Promise<td_api::object_ptr<td_api::chatBoostSlots>> &&promise);
void get_dialog_boost_status(DialogId dialog_id, Promise<td_api::object_ptr<td_api::chatBoostStatus>> &&promise);

View File

@ -6721,6 +6721,12 @@ void Td::on_request(uint64 id, const td_api::getChatBoostLevelFeatures &request)
promise.set_value(boost_manager_->get_chat_boost_level_features_object(request.level_));
}
void Td::on_request(uint64 id, const td_api::getChatBoostFeatures &request) {
CHECK_IS_USER();
CREATE_REQUEST_PROMISE();
promise.set_value(boost_manager_->get_chat_boost_features_object());
}
void Td::on_request(uint64 id, const td_api::getAvailableChatBoostSlots &request) {
CHECK_IS_USER();
CREATE_REQUEST_PROMISE();

View File

@ -1071,6 +1071,8 @@ class Td final : public Actor {
void on_request(uint64 id, const td_api::getChatBoostLevelFeatures &request);
void on_request(uint64 id, const td_api::getChatBoostFeatures &request);
void on_request(uint64 id, const td_api::getAvailableChatBoostSlots &request);
void on_request(uint64 id, const td_api::getChatBoostStatus &request);

View File

@ -4450,6 +4450,8 @@ class CliClient final : public Actor {
int32 level;
get_args(args, level);
send_request(td_api::make_object<td_api::getChatBoostLevelFeatures>(level));
} else if (op == "gcbf") {
send_request(td_api::make_object<td_api::getChatBoostFeatures>());
} else if (op == "gacbs") {
send_request(td_api::make_object<td_api::getAvailableChatBoostSlots>());
} else if (op == "gcbs") {