From 586ff2e8953847fd5a7d0c84e5c41ec739a6ef48 Mon Sep 17 00:00:00 2001 From: Vladless Date: Sat, 14 Feb 2026 22:27:52 +0300 Subject: [PATCH] admins do not touch the shadow ban --- middlewares/ban_checker.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/middlewares/ban_checker.py b/middlewares/ban_checker.py index f749a3c6..d054c166 100644 --- a/middlewares/ban_checker.py +++ b/middlewares/ban_checker.py @@ -8,7 +8,7 @@ from pytz import timezone from sqlalchemy import select from sqlalchemy.ext.asyncio import AsyncSession -from config import SUPPORT_CHAT_URL +from config import ADMIN_ID, SUPPORT_CHAT_URL from database.models import ManualBan from logger import logger @@ -79,6 +79,10 @@ class BanCheckerMiddleware(BaseMiddleware): reason = ban_info["reason"] 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: + return await handler(event, data) + if reason == "shadow": logger.info(f"[BanChecker] Теневой бан: пользователь {tg_id} — действия игнорируются.") return