Третий стрим

This commit is contained in:
2024-03-17 21:28:49 +04:00
parent a498a04481
commit 17cd64bdbc
29 changed files with 618 additions and 50 deletions

View File

View File

@ -0,0 +1,18 @@
from typing import Callable, Dict, Any, Awaitable
from aiogram import BaseMiddleware
from aiogram.types import TelegramObject, User
from app.settings import secrets
class AdminMiddleware(BaseMiddleware):
async def __call__(
self,
handler: Callable[[TelegramObject, Dict[str, Any]], Awaitable[Any]],
event: TelegramObject,
data: Dict[str, Any]
) -> Any:
user: User = data.get("event_from_user")
if user.id == secrets.admin_id:
return await handler(event, data)