Add options with Telegram Star to USD conversion rates.

This commit is contained in:
levlam 2024-08-12 19:37:49 +03:00
parent 3e4aa8e98e
commit 503dde513a
3 changed files with 11 additions and 1 deletions

View File

@ -2062,6 +2062,14 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
G()->set_option_integer("subscription_star_count_max", get_json_value_int(std::move(key_value->value_), key));
continue;
}
if (key == "stars_usd_sell_rate_x1000") {
G()->set_option_integer("usd_to_1000_star_rate", get_json_value_int(std::move(key_value->value_), key));
continue;
}
if (key == "stars_usd_withdraw_rate_x1000") {
G()->set_option_integer("1000_star_to_usd_rate", get_json_value_int(std::move(key_value->value_), key));
continue;
}
new_values.push_back(std::move(key_value));
}

View File

@ -85,7 +85,7 @@ class ConfigManager final : public NetQueryCallback {
private:
struct AppConfig {
static constexpr int32 CURRENT_VERSION = 58;
static constexpr int32 CURRENT_VERSION = 59;
int32 version_ = 0;
int32 hash_ = 0;
telegram_api::object_ptr<telegram_api::JSONValue> config_;

View File

@ -158,6 +158,8 @@ OptionManager::OptionManager(Td *td)
set_default_integer_option("bot_media_preview_count_max", 12);
set_default_integer_option("paid_reaction_star_count_max", 2500);
set_default_integer_option("subscription_star_count_max", 2500);
set_default_integer_option("usd_to_1000_star_rate", 1410);
set_default_integer_option("1000_star_to_usd_rate", 1200);
if (options.isset("my_phone_number") || !options.isset("my_id")) {
update_premium_options();