Answer the question
In order to leave comments, you need to log in
How to make State in callback_query_handler?
Good evening!!
Who can easily tell me how to create a State in callback_query_handler?
I would be grateful for help, otherwise where can I find the answer.
@dp.callback_query_handler(lambda x: x.data and x.data.startswith('time'),state=None)
async def callback_run(callback_query: CallbackQuery,state: FSMContext):
async with state.proxy() as data:
data['description'] = message.text
await FSMClient.description.set()
await message.answer("Напишіть коротко юридичне питання")
await bot_db.sql_add_command1(state)
await state.finish()
Answer the question
In order to leave comments, you need to log in
I almost did not understand the question and what you want to do.
@dp.message_handler(Command("start"), state='*')
async def show_menu(message: types.Message, state: FSMContext):
await state.finish()
await States.first.set()
.........
@dp.callback_query_handler(callback_data.filter(), state=States.first)
async def first_step(callback: types.CallbackQuery, state: FSMContext):
.....
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question