class RegisterCheck(BaseMiddleware):
async def __call__(
self,
event: Update,
handler: Callable[[Update, Dict[str, Any]], Awaitable[Any]],
data: Dict[str, Any]
) -> Any:
if data['event_from_user'].id == db.user.id: #обращение условное при тестах использовал свой тг-айди
return await handler(event, data)
else:
await event.message.answer('you are not registered')
return
async def register_check(
handler: Callable[[Update, Dict[str, Any]], Awaitable[Any]],
event: Update,
data: Dict[str, Any]
) -> Any:
if data['event_from_user'].id == db.user.id:
return await handler(event, data)
else:
await event.message.answer('you are not registered')
return