Add "giveaway_additional_chat_count_max" option.
This commit is contained in:
parent
129a04b24d
commit
e24f68a4ff
@ -2300,7 +2300,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
|
//@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 365 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 from 1 minute to 365 days 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
|
//@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
|
||||||
|
@ -1917,6 +1917,11 @@ 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_add_peers_max") {
|
||||||
|
G()->set_option_integer("giveaway_additional_chat_count_max",
|
||||||
|
get_json_value_int(std::move(key_value->value_), key));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
new_values.push_back(std::move(key_value));
|
new_values.push_back(std::move(key_value));
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ class ConfigManager final : public NetQueryCallback {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct AppConfig {
|
struct AppConfig {
|
||||||
static constexpr int32 CURRENT_VERSION = 14;
|
static constexpr int32 CURRENT_VERSION = 15;
|
||||||
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_;
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "td/telegram/Dependencies.h"
|
#include "td/telegram/Dependencies.h"
|
||||||
#include "td/telegram/DialogId.h"
|
#include "td/telegram/DialogId.h"
|
||||||
#include "td/telegram/MessagesManager.h"
|
#include "td/telegram/MessagesManager.h"
|
||||||
|
#include "td/telegram/OptionManager.h"
|
||||||
#include "td/telegram/Td.h"
|
#include "td/telegram/Td.h"
|
||||||
|
|
||||||
#include "td/utils/Random.h"
|
#include "td/utils/Random.h"
|
||||||
@ -44,6 +45,9 @@ Result<GiveawayParameters> GiveawayParameters::get_giveaway_parameters(
|
|||||||
TRY_RESULT(channel_id, get_boosted_channel_id(td, DialogId(additional_chat_id)));
|
TRY_RESULT(channel_id, get_boosted_channel_id(td, DialogId(additional_chat_id)));
|
||||||
additional_channel_ids.push_back(channel_id);
|
additional_channel_ids.push_back(channel_id);
|
||||||
}
|
}
|
||||||
|
if (additional_channel_ids.size() > td->option_manager_->get_option_integer("giveaway_additional_chat_count_max")) {
|
||||||
|
return Status::Error(400, "Too many additional chats specified");
|
||||||
|
}
|
||||||
if (parameters->winners_selection_date_ < G()->unix_time()) {
|
if (parameters->winners_selection_date_ < G()->unix_time()) {
|
||||||
return Status::Error(400, "Giveaway date is in the past");
|
return Status::Error(400, "Giveaway date is in the past");
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,9 @@ OptionManager::OptionManager(Td *td)
|
|||||||
if (!have_option("story_stealth_mode_cooldown_period")) {
|
if (!have_option("story_stealth_mode_cooldown_period")) {
|
||||||
set_option_integer("story_stealth_mode_cooldown_period", 3600);
|
set_option_integer("story_stealth_mode_cooldown_period", 3600);
|
||||||
}
|
}
|
||||||
|
if (!have_option("giveaway_additional_chat_count_max")) {
|
||||||
|
set_option_integer("giveaway_additional_chat_count_max", G()->is_test_dc() ? 3 : 10);
|
||||||
|
}
|
||||||
|
|
||||||
set_option_empty("archive_and_mute_new_chats_from_unknown_users");
|
set_option_empty("archive_and_mute_new_chats_from_unknown_users");
|
||||||
set_option_empty("chat_filter_count_max");
|
set_option_empty("chat_filter_count_max");
|
||||||
|
Loading…
Reference in New Issue
Block a user