From 132fc5fd22e7dc80de6dce2d4e186d4c498986f3 Mon Sep 17 00:00:00 2001 From: uran-content Date: Mon, 28 Jul 2025 15:22:06 +0300 Subject: [PATCH] settings for max_sends_per_secods --- aiogram/client/bot.py | 4 ++-- aiogram/client/default.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/aiogram/client/bot.py b/aiogram/client/bot.py index 531db195..fb36062c 100644 --- a/aiogram/client/bot.py +++ b/aiogram/client/bot.py @@ -292,10 +292,10 @@ class Bot: if session is None: session = AiohttpSession() if default is None: - default = DefaultBotProperties() + default = DefaultBotProperties(max_sends_per_secods=29) self.session = session - self.limiter = PrioritySlidingWindowLimiter(max_calls=29, period=1.0) + self.limiter = PrioritySlidingWindowLimiter(max_calls=default.max_sends_per_secods, period=1.0) # Few arguments are completely removed in 3.7.0 version # Temporary solution to raise an error if user passed these arguments diff --git a/aiogram/client/default.py b/aiogram/client/default.py index 78dd0aa3..e3e70cfb 100644 --- a/aiogram/client/default.py +++ b/aiogram/client/default.py @@ -55,6 +55,7 @@ class DefaultBotProperties: """Show link preview above text.""" show_caption_above_media: Optional[bool] = None """Show caption above media.""" + max_sends_per_secods: Optional[int] = None def __post_init__(self) -> None: has_any_link_preview_option = any(