Template
mirror of
https://github.com/djimboy/djimbo_template_aio3.git
synced 2026-08-27 23:47:44 +00:00
Update
This commit is contained in:
@@ -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>",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user