Add internal premium stickers options.

This commit is contained in:
levlam 2022-06-10 13:04:46 +03:00
parent 70f4e9d3cc
commit 59620b0e7d
2 changed files with 16 additions and 1 deletions

View File

@ -1483,6 +1483,8 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
string premium_bot_username;
string premium_invoice_slug;
bool is_premium_available = false;
int32 stickers_premium_by_emoji_num = 0;
int32 stickers_normal_by_emoji_per_premium_num = 2;
if (config->get_id() == telegram_api::jsonObject::ID) {
for (auto &key_value : static_cast<telegram_api::jsonObject *>(config.get())->value_) {
Slice key = key_value->key_;
@ -1790,6 +1792,14 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
is_premium_available = get_json_value_bool(std::move(key_value->value_), key);
continue;
}
if (key == "stickers_premium_by_emoji_num") {
stickers_premium_by_emoji_num = get_json_value_int(std::move(key_value->value_), key);
continue;
}
if (key == "stickers_normal_by_emoji_per_premium_num") {
stickers_normal_by_emoji_per_premium_num = get_json_value_int(std::move(key_value->value_), key);
continue;
}
new_values.push_back(std::move(key_value));
}
@ -1909,6 +1919,10 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
shared_config.set_option_string("premium_invoice_slug", premium_invoice_slug);
}
shared_config.set_option_integer("stickers_premium_by_emoji_num", stickers_premium_by_emoji_num);
shared_config.set_option_integer("stickers_normal_by_emoji_per_premium_num",
stickers_normal_by_emoji_per_premium_num);
shared_config.set_option_empty("default_ton_blockchain_config");
shared_config.set_option_empty("default_ton_blockchain_name");

View File

@ -199,7 +199,8 @@ bool OptionManager::is_internal_option(Slice name) {
case 's':
return name == "saved_animations_limit" || name == "saved_gifs_limit_default" ||
name == "saved_gifs_limit_premium" || name == "session_count" || name == "stickers_faved_limit_default" ||
name == "stickers_faved_limit_premium";
name == "stickers_faved_limit_premium" || name == "stickers_normal_by_emoji_per_premium_num" ||
name == "stickers_premium_by_emoji_num";
case 'v':
return name == "video_note_size_max";
case 'w':