This commit is contained in:
dj
2025-10-10 07:04:08 +03:00
parent 9a48d6f60f
commit c9099dac69
26 changed files with 738 additions and 405 deletions
+2 -10
View File
@@ -8,7 +8,7 @@ from aiogram.types import Message, User
from cachetools import TTLCache
# Антиспам
# Antiflood
class ThrottlingMiddleware(BaseMiddleware):
def __init__(self, default_rate: Union[int, float] = 0.5) -> None:
self.default_rate = default_rate
@@ -49,15 +49,7 @@ class ThrottlingMiddleware(BaseMiddleware):
self.users[this_user.id]['count_throttled'] = 2
self.users[this_user.id]['now_rate'] = self.default_rate + 3
await event.reply(
"<b>❗ Пожалуйста, не спамьте.\n"
"❗ Please, do not spam.</b>",
)
await event.reply("<b>❗ Please, do not spam.")
elif self.users[this_user.id]['count_throttled'] == 2:
self.users[this_user.id]['count_throttled'] = 3
self.users[this_user.id]['now_rate'] = self.default_rate + 5
await event.reply(
"<b>❗ Бот не будет отвечать до прекращения спама.\n"
"❗ The bot will not respond until the spam stops.</b>",
)