chatgpt_bot/bot/handlers/user/user_handlers.py
2024-10-05 17:35:26 +03:00

26 lines
749 B
Python

from aiogram import Router, types
from aiogram.filters import CommandStart
from bot.handlers.user.page_processing import get_page_content
from bot.kbs.inline import PageCallBack
user = Router()
@user.message(CommandStart())
async def start(message: types.Message):
text, reply_markup = await get_page_content(page=0,name="main")
await message.answer(text, reply_markup=reply_markup)
@user.callback_query(PageCallBack.filter())
async def user_pages(callback: types.CallbackQuery, callback_data: PageCallBack):
text, reply_markup = await get_page_content(
page=callback_data.page,
name=callback_data.page_name,
)
await callback.message.edit_text(text, reply_markup=reply_markup)
await callback.answer()