Add "giveaway_duration_max" option.

This commit is contained in:
levlam 2023-10-18 18:28:55 +03:00
parent 7eec2eb54b
commit 6ec7ab73e5
4 changed files with 9 additions and 2 deletions

View File

@ -2312,7 +2312,7 @@ messageExtendedMediaUnsupported caption:formattedText = MessageExtendedMedia;
//@description Describes parameters of a Telegram Premium giveaway //@description Describes parameters of a Telegram Premium giveaway
//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription //@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription
//@additional_chat_ids Identifiers of other channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats //@additional_chat_ids Identifiers of other channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats
//@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be from 1 minute to 7 days in the future in scheduled giveaways //@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways
//@only_new_subscribers True, if only new subscribers of the chats will be eligible for the giveaway //@only_new_subscribers True, if only new subscribers of the chats will be eligible for the giveaway
//@country_codes The list of two-letter ISO 3166-1 alpha-2 codes of countries, only users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. There can be up to getOption("giveaway_country_count_max") chosen countries //@country_codes The list of two-letter ISO 3166-1 alpha-2 codes of countries, only users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. There can be up to getOption("giveaway_country_count_max") chosen countries
premiumGiveawayParameters boosted_chat_id:int53 additional_chat_ids:vector<int53> winners_selection_date:int32 only_new_subscribers:Bool country_codes:vector<string> = PremiumGiveawayParameters; premiumGiveawayParameters boosted_chat_id:int53 additional_chat_ids:vector<int53> winners_selection_date:int32 only_new_subscribers:Bool country_codes:vector<string> = PremiumGiveawayParameters;

View File

@ -1931,6 +1931,10 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
get_json_value_int(std::move(key_value->value_), key)); get_json_value_int(std::move(key_value->value_), key));
continue; continue;
} }
if (key == "giveaway_period_max") {
G()->set_option_integer("giveaway_duration_max", get_json_value_int(std::move(key_value->value_), key));
continue;
}
if (key == "channel_color_level_min") { if (key == "channel_color_level_min") {
G()->set_option_integer("channel_custom_accent_color_boost_level_min", G()->set_option_integer("channel_custom_accent_color_boost_level_min",
get_json_value_int(std::move(key_value->value_), key)); get_json_value_int(std::move(key_value->value_), key));

View File

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

View File

@ -137,6 +137,9 @@ OptionManager::OptionManager(Td *td)
if (!have_option("giveaway_boost_count_per_premium")) { if (!have_option("giveaway_boost_count_per_premium")) {
set_option_integer("giveaway_boost_count_per_premium", 4); set_option_integer("giveaway_boost_count_per_premium", 4);
} }
if (!have_option("giveaway_duration_max")) {
set_option_integer("giveaway_duration_max", 7 * 86400);
}
if (!have_option("channel_custom_accent_color_boost_level_min")) { if (!have_option("channel_custom_accent_color_boost_level_min")) {
set_option_integer("channel_custom_accent_color_boost_level_min", 1); set_option_integer("channel_custom_accent_color_boost_level_min", 1);
} }