kostyl da
This commit is contained in:
1 parent
dac0a6569c
commit
ea38436bce
2 files changed
+16
-9
No files matched your search
+7
-6
@@ -10,12 +10,13 @@ from supergenerator import *
|
||||
def is_blocked(user_id):
|
||||
current_time = time.time()
|
||||
if user_id:
|
||||
if user_id in last_command_time:
|
||||
time_diff = current_time - last_command_time[user_id]
|
||||
if time_diff < 3:
|
||||
alo = "🚫 *файл не вошёл.* хватит так быстро слать свои сообщения.\n" \
|
||||
f"подожди {round(3 - time_diff, 3)} секунд, брат😡😡"
|
||||
return alo, True
|
||||
if not user_id in last_command_time:
|
||||
last_command_time[user_id] = current_time - 3
|
||||
time_diff = current_time - last_command_time[user_id]
|
||||
if time_diff < 3:
|
||||
alo = "🚫 *файл не вошёл.* хватит так быстро слать свои сообщения.\n" \
|
||||
f"подожди {round(3 - time_diff, 3)} секунд, брат😡😡"
|
||||
return alo, True
|
||||
return "", False
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ from colors import *
|
||||
from helpers import *
|
||||
from commands import *
|
||||
from dotenv import load_dotenv
|
||||
from random import uniform
|
||||
|
||||
try:
|
||||
from config import *
|
||||
@@ -94,6 +95,9 @@ async def guest_middleware(handler, event, data):
|
||||
return
|
||||
|
||||
if user_id:
|
||||
if is_channel:
|
||||
await asyncio.sleep(uniform(0,1))
|
||||
|
||||
text, blocked = is_blocked(user_id)
|
||||
if blocked:
|
||||
if event.guest_message:
|
||||
@@ -105,19 +109,19 @@ async def guest_middleware(handler, event, data):
|
||||
await error_message.delete()
|
||||
except Exception as e:
|
||||
print(f"{YELLOW} -- del err - {e}{RESET}")
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
ensure_user(user_id)
|
||||
|
||||
if event.message:
|
||||
try:
|
||||
await bot.send_chat_action(chat_id=message.chat.id, action="typing")
|
||||
except TelegramForbiddenError:
|
||||
return
|
||||
|
||||
ensure_user(user_id)
|
||||
|
||||
last_command_time[user_id] = current_time
|
||||
|
||||
msg = None
|
||||
replied = message.reply_to_message or None
|
||||
if replied:
|
||||
@@ -301,6 +305,8 @@ async def guest_middleware(handler, event, data):
|
||||
|
||||
if event.guest_message:
|
||||
add_one_to("stats/guest")
|
||||
else:
|
||||
return
|
||||
|
||||
try:
|
||||
if event.guest_message:
|
||||
|
||||
Reference in new issue
Block a user