admins do not touch the shadow ban

This commit is contained in:
Vladless
2026-02-14 22:42:17 +03:00
parent 586ff2e895
commit 534313ce12
2 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ class BanCheckerMiddleware(BaseMiddleware):
until = ban_info["until"]
admin_ids = set(ADMIN_ID) if isinstance(ADMIN_ID, (list, tuple)) else {ADMIN_ID}
if reason == "shadow" and tg_id in admin_ids:
if tg_id in admin_ids:
return await handler(event, data)
if reason == "shadow":
+9 -1
View File
@@ -7,7 +7,7 @@ from aiogram import BaseMiddleware
from aiogram.types import Message, Update
from sqlalchemy.ext.asyncio import AsyncSession
from config import DISABLE_DIRECT_START
from config import ADMIN_ID, DISABLE_DIRECT_START
from core.bootstrap import MODES_CONFIG
from database import check_user_exists
from logger import logger
@@ -31,6 +31,14 @@ class DirectStartBlockerMiddleware(BaseMiddleware):
if not direct_start_disabled:
return await handler(event, data)
user = getattr(event, "message", None) and getattr(event.message, "from_user", None)
if not user and getattr(event, "callback_query", None):
user = getattr(event.callback_query, "from_user", None)
if user:
admin_ids = set(ADMIN_ID) if isinstance(ADMIN_ID, (list, tuple)) else {ADMIN_ID}
if user.id in admin_ids:
return await handler(event, data)
message: Message | None = getattr(event, "message", None)
if not message or not message.text:
return await handler(event, data)