aiozab/routers/commands/test_commands.py
2025-02-23 12:05:49 +05:00

23 lines
830 B
Python

# handlers.py
from aiogram import types
from aiogram import Router, F
from sqlalchemy.future import select
from utils.db import AsyncSessionLocal
from utils.db.whitelist import Whitelist
router = Router()
@router.message(F.text == "Проверка функций" and F.from_user.id == 211595028)
async def check_access(message: types.Message):
chat_id = message.chat.id
async with AsyncSessionLocal() as session:
stmt = select(Whitelist).filter_by(chat_id=chat_id)
result = await session.execute(stmt)
user = result.scalars().first()
if user:
await message.answer(f"Ваш логин: {user.username}.\nВаш E-mail: {user.user_email}\nВаш чат ID: {user.chat_id}")
else:
await message.answer("Вы не в списке разрешенных.")