Answer the question
In order to leave comments, you need to log in
How to pull certain text from an inline button and pass it to the state proxy?
How to pull out a certain text from an inline button and transfer it to the state proxy, moreover, there is a text like a bot there, and not just in an inline button.
#@dp.message_handler(lambda message: message.text == "Записатися на прийом ", state=None)
async def specialist(message: types.Message):
await FSMClient.specialist.set()
read = await bot_db.sql_read2()
for ret in read:
await message.answer('Виберіть спеціаліста:', reply_markup=InlineKeyboardMarkup().add(InlineKeyboardButton(f'{ret[0]}', callback_data='spel')))
@dp.callback_query_handler(lambda c: c.data == 'spel', state=FSMClient.specialist)
async def handle_a(callback_query: types.CallbackQuery, state: FSMContext):
await FSMClient.next()
async with state.proxy() as data:
data["specialist"] = callback_query.message.text
await callback_query.message.answer('Виберіть послугу:', reply_markup=keyboard_inline_buttons)
@dp.callback_query_handler(lambda c: c.data == 'calendar', state=FSMClient.service)
async def callback_run(callback_query: types.CallbackQuery, state: FSMContext):
await FSMClient.next()
async with state.proxy() as data:
data["service"] = callback_query.message.text
await callback_query.message.answer("Виберіть будь-ласка,зручну для вас дату",reply_markup=await SimpleCalendar().start_calendar())
@dp.callback_query_handler(simple_cal_callback.filter(), state=FSMClient.data)
async def process_simple_calendar(callback_query: CallbackQuery, callback_data: dict, state: FSMContext):
selected, date = await SimpleCalendar().process_selection(callback_query, callback_data)
if selected:
await FSMClient.next()
async with state.proxy() as data:
data["data"] = callback_query.message.text
await callback_query.message.answer(f'Ви вибрали {date.strftime("%d/%m/%Y")}', reply_markup=time)
@dp.callback_query_handler(lambda c: c.data == 'time', state=FSMClient.time)
async def callback_run(callback_query: types.CallbackQuery, state: FSMContext):
async with state.proxy() as data:
data["time"] = callback_query.message.text
await FSMClient.next()
await callback_query.message.answer("Напишіть юридичні питання")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question