This commit is contained in:
2023-10-28 16:31:26 +03:00
commit 58775f9935
6 changed files with 91 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
from typing import Any, Awaitable, Callable, Dict
from aiogram import BaseMiddleware
from aiogram.types import Message
ADMIN_LIST = [248770879, 395543883]
class AdminMiddleware(BaseMiddleware):
def __init__(self) -> None:
pass
async def __call__(self, handler: Callable[[Message, Dict[str, Any]], Awaitable[Any]], event: Message, data: Dict[str, Any]) -> Any:
if event.from_user.id in ADMIN_LIST:
await event.answer('Команда только для админов!')
return None
return await handler(event, data)