Доброго всем дня!!!
Пишу бота на aiogram,и незнаю как в callback_query_handler запихнуть машину состояния
Буду благодарний за помоч где що почитать
#@dp.message_handler(lambda message: message.text == "Записатися на прийом ", state=None)
async def specialist(message: types.Message, state: FSMContext):
read = await bot_db.sql_read2()
for ret in read:
await FSMClient.specialist.set()
await message.answer('Виберіть спеціаліста:', reply_markup=InlineKeyboardMarkup().add(InlineKeyboardButton(f'{ret[0]}', callback_data='spel')))
#@dp.callback_query_handler(text_contains='spel', state=FSMClient.service)
async def callback_run(callback_query: CallbackQuery, state: FSMContext):
async with state.proxy() as data:
data['service'] = callback_query.message.text
await FSMClient.next()
await callback_query.message.answer(text=f"Виберіть спеціаліста",reply_markup=keyboard_inline_buttons)
#@dp.callback_query_handler(text_contains='calendar', state=FSMClient.data)
async def callback_run(callback_query: CallbackQuery, state: FSMContext):
async with state.proxy() as data:
data['data'] = callback_query.message.text
await FSMClient.next()
await callback_query.message.answer(text=f"виберіть будь-ласка,зручну для вас дату",reply_markup=await SimpleCalendar().start_calendar())
@dp.callback_query_handler(simple_cal_callback.filter())
async def process_simple_calendar(callback_query: CallbackQuery, callback_data: dict):
selected, date = await SimpleCalendar().process_selection(callback_query, callback_data)
if selected:
await callback_query.message.answer(
f'Ви вибрали {date.strftime("%Y-/%m-%d")}',reply_markup=time)
#@dp.callback_query_handler(text_contains='time', state=FSMClient.time)
async def callback_run(callback_query: CallbackQuery, state: FSMContext):
async with state.proxy() as data:
data['time'] = callback_query.message.text
await FSMClient.next()
await callback_query.message.answer(text=f"Напишити юридичне питання")