Add "fact_check_length_max" option.

This commit is contained in:
levlam 2024-05-22 14:26:55 +03:00
parent fa6ed08534
commit 84167ef157
4 changed files with 8 additions and 2 deletions

View File

@ -8344,7 +8344,7 @@ editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:Messa
//@description Changes the fact-check of a message. Can be only used if getOption("can_edit_fact_check") == true
//@chat_id The channel chat the message belongs to
//@message_id Identifier of the message
//@text New text of the fact-check; 0-1024 characters; pass null to remove it. Only Bold, Italic, and TextUrl entities are supported
//@text New text of the fact-check; 0-getOption("fact_check_length_max") characters; pass null to remove it. Only Bold, Italic, and TextUrl entities are supported
setMessageFactCheck chat_id:int53 message_id:int53 text:formattedText = Ok;

View File

@ -2001,6 +2001,11 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
can_edit_fact_check = get_json_value_bool(std::move(key_value->value_), key);
continue;
}
if (key == "factcheck_length_limit") {
G()->set_option_integer("fact_check_length_max",
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 = 45;
static constexpr int32 CURRENT_VERSION = 46;
int32 version_ = 0;
int32 hash_ = 0;
telegram_api::object_ptr<telegram_api::JSONValue> config_;

View File

@ -150,6 +150,7 @@ OptionManager::OptionManager(Td *td)
set_default_integer_option("upload_premium_speedup_notify_period", 3600);
set_default_integer_option("business_chat_link_count_max", is_test_dc ? 5 : 100);
set_default_integer_option("pinned_story_count_max", 3);
set_default_integer_option("fact_check_length_max", 1024);
if (options.isset("my_phone_number") || !options.isset("my_id")) {
update_premium_options();