mirror of
https://github.com/MrSedan/neuro-reply-bot-reworked.git
synced 2026-01-14 21:49:42 +03:00
Initial
This commit is contained in:
17
handlers/middlewares/user.py
Normal file
17
handlers/middlewares/user.py
Normal 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)
|
||||
|
||||
Reference in New Issue
Block a user