BOT_open_sesam/handlers/start_handler.py

22 lines
762 B
Python

from aiogram import Dispatcher, F
from aiogram.types import Message
from aiogram.filters import CommandStart
from keyboard import get_keyboard
from auth import is_user_auth
def register_start_handler(dp: Dispatcher):
@dp.message(CommandStart())
async def command_start_handler(msg: Message):
user_id = msg.from_user.id
if is_user_auth(user_id):
await msg.answer(
"Авторизация прошла успешно", reply_markup=get_keyboard(authorized=True)
)
else:
await msg.answer(
"Для пользования ботом, предоставьте номер телефона",
reply_markup=get_keyboard(authorized=False),
)