Add weekly and monthly limits for sent stories.

This commit is contained in:
levlam 2023-08-11 15:35:13 +03:00
parent 499cd02a0a
commit cabd71c3c3
5 changed files with 32 additions and 5 deletions

View File

@ -3984,6 +3984,12 @@ premiumLimitTypeShareableChatFolderCount = PremiumLimitType;
//@description The maximum number of active stories //@description The maximum number of active stories
premiumLimitTypeActiveStoryCount = PremiumLimitType; premiumLimitTypeActiveStoryCount = PremiumLimitType;
//@description The maximum number of stories sent per week
premiumLimitTypeWeeklySentStoryCount = PremiumLimitType;
//@description The maximum number of stories sent per month
premiumLimitTypeMonthlySentStoryCount = PremiumLimitType;
//@description The maximum length of captions of sent stories //@description The maximum length of captions of sent stories
premiumLimitTypeStoryCaptionLength = PremiumLimitType; premiumLimitTypeStoryCaptionLength = PremiumLimitType;

View File

@ -2014,6 +2014,10 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
options.get_option_integer("dialog_filters_chats_limit_premium", 200)); options.get_option_integer("dialog_filters_chats_limit_premium", 200));
options.set_option_integer("active_story_count_max", options.set_option_integer("active_story_count_max",
options.get_option_integer("story_expiring_limit_premium", 100)); options.get_option_integer("story_expiring_limit_premium", 100));
options.set_option_integer("weekly_sent_story_count_max",
options.get_option_integer("stories_sent_weekly_limit_premium", 700));
options.set_option_integer("monthly_sent_story_count_max",
options.get_option_integer("stories_sent_monthly_limit_premium", 3000));
options.set_option_integer("story_caption_length_max", options.set_option_integer("story_caption_length_max",
options.get_option_integer("story_caption_length_limit_premium", 2048)); options.get_option_integer("story_caption_length_limit_premium", 2048));
options.set_option_integer("bio_length_max", options.get_option_integer("about_length_limit_premium", 140)); options.set_option_integer("bio_length_max", options.get_option_integer("about_length_limit_premium", 140));
@ -2032,8 +2036,11 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
options.set_option_integer("chat_folder_count_max", options.get_option_integer("dialog_filters_limit_default", 10)); options.set_option_integer("chat_folder_count_max", options.get_option_integer("dialog_filters_limit_default", 10));
options.set_option_integer("chat_folder_chosen_chat_count_max", options.set_option_integer("chat_folder_chosen_chat_count_max",
options.get_option_integer("dialog_filters_chats_limit_default", 100)); options.get_option_integer("dialog_filters_chats_limit_default", 100));
options.set_option_integer("active_story_count_max", options.set_option_integer("active_story_count_max", options.get_option_integer("story_expiring_limit_default", 3));
options.get_option_integer("story_expiring_limit_default", 30)); options.set_option_integer("weekly_sent_story_count_max",
options.get_option_integer("stories_sent_weekly_limit_default", 7));
options.set_option_integer("monthly_sent_story_count_max",
options.get_option_integer("stories_sent_monthly_limit_default", 30));
options.set_option_integer("story_caption_length_max", options.set_option_integer("story_caption_length_max",
options.get_option_integer("story_caption_length_limit_default", 200)); options.get_option_integer("story_caption_length_limit_default", 200));
options.set_option_integer("bio_length_max", options.get_option_integer("about_length_limit_default", 70)); options.set_option_integer("bio_length_max", options.get_option_integer("about_length_limit_default", 70));

View File

@ -102,7 +102,7 @@ class ConfigManager final : public NetQueryCallback {
private: private:
struct AppConfig { struct AppConfig {
static constexpr int32 CURRENT_VERSION = 11; static constexpr int32 CURRENT_VERSION = 12;
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

@ -311,7 +311,9 @@ bool OptionManager::is_internal_option(Slice name) {
name == "saved_gifs_limit_premium" || name == "session_count" || name == "since_last_open" || name == "saved_gifs_limit_premium" || name == "session_count" || name == "since_last_open" ||
name == "stickers_faved_limit_default" || name == "stickers_faved_limit_premium" || name == "stickers_faved_limit_default" || name == "stickers_faved_limit_premium" ||
name == "stickers_normal_by_emoji_per_premium_num" || name == "stickers_premium_by_emoji_num" || name == "stickers_normal_by_emoji_per_premium_num" || name == "stickers_premium_by_emoji_num" ||
name == "stories_changelog_user_id" || name == "story_caption_length_limit_default" || name == "stories_changelog_user_id" || name == "stories_sent_monthly_limit_default" ||
name == "stories_sent_monthly_limit_premium" || name == "stories_sent_weekly_limit_default" ||
name == "stories_sent_weekly_limit_premium" || name == "story_caption_length_limit_default" ||
name == "story_caption_length_limit_premium" || name == "story_expiring_limit_default" || name == "story_caption_length_limit_premium" || name == "story_expiring_limit_default" ||
name == "story_expiring_limit_premium"; name == "story_expiring_limit_premium";
case 'v': case 'v':

View File

@ -307,7 +307,9 @@ const vector<Slice> &get_premium_limit_keys() {
"chatlist_invites", "chatlist_invites",
"chatlists_joined", "chatlists_joined",
"story_expiring", "story_expiring",
"story_caption_length"}; "story_caption_length",
"stories_sent_weekly",
"stories_sent_monthly"};
return limit_keys; return limit_keys;
} }
@ -342,6 +344,10 @@ static Slice get_limit_type_key(const td_api::PremiumLimitType *limit_type) {
return Slice("story_expiring"); return Slice("story_expiring");
case td_api::premiumLimitTypeStoryCaptionLength::ID: case td_api::premiumLimitTypeStoryCaptionLength::ID:
return Slice("story_caption_length"); return Slice("story_caption_length");
case td_api::premiumLimitTypeWeeklySentStoryCount::ID:
return Slice("stories_sent_weekly");
case td_api::premiumLimitTypeMonthlySentStoryCount::ID:
return Slice("stories_sent_monthly");
default: default:
UNREACHABLE(); UNREACHABLE();
return Slice(); return Slice();
@ -505,6 +511,12 @@ static td_api::object_ptr<td_api::premiumLimit> get_premium_limit_object(Slice k
if (key == "story_caption_length") { if (key == "story_caption_length") {
return td_api::make_object<td_api::premiumLimitTypeStoryCaptionLength>(); return td_api::make_object<td_api::premiumLimitTypeStoryCaptionLength>();
} }
if (key == "stories_sent_weekly") {
return td_api::make_object<td_api::premiumLimitTypeWeeklySentStoryCount>();
}
if (key == "stories_sent_monthly") {
return td_api::make_object<td_api::premiumLimitTypeMonthlySentStoryCount>();
}
UNREACHABLE(); UNREACHABLE();
return nullptr; return nullptr;
}(); }();