работает на aiogram python , незнаю как применить машину состояний
@dp.message_handler(text=['Онлайн-заказ'])
async def process_command_1(message: types.Message):
await message.reply("Выберите продукцию :", reply_markup=inline_kb)
@dp.callback_query_handler(lambda c: c.data == 'convert')
async def process_callback_button1(callback_query: types.CallbackQuery , state: FSMContext):
await bot.answer_callback_query(callback_query.id)
await bot.send_message(callback_query.from_user.id, 'Количество сторон ?', reply_markup=inline_kb1)
async with state.proxy() as data:
data['ref1'] = ref_id_1lv
data['ref2'] = ref_id_2lv
@dp.callback_query_handler(lambda c: c.data == 'allpanton')
async def process_callback_button1(callback_query: types.CallbackQuery , state: FSMContext):
await bot.answer_callback_query(callback_query.id)
await bot.send_message(callback_query.from_user.id, 'Выберите размер ?', reply_markup=inline_kb2)
@dp.callback_query_handler(lambda c: c.data == 'sizew1')
async def process_callback_button1(callback_query: types.CallbackQuery , state: FSMContext):
await bot.answer_callback_query(callback_query.id)
await bot.send_message(callback_query.from_user.id, 'Выберите количество ?',reply_markup=inline_kb3)
async with state.proxy() as data:
ref_id_1lv = data['ref1']
ref_id_2lv = data['ref2']
await state.finish()
Вопрос задан
более трёх лет назад
216 просмотров