A few processors in aiogram



  • How to respond to several types of combinations in one soot. At this point, I have a problem in processing two events. Exactly: sending a regular message and pressing the button. I can't figure out how to do this in one situation?



  • So I solved my problem. If we need to do a few types of processors in the same state, what do we prevent us from doing the right co-processing, but with the same condition? That's right. I'll add my code below.

    class DialogMachine(StatesGroup):
        one_state = State()
    

    @dp.message_handler(state=DialogMachine.one_state)
    async def one_state_msg(message: types.Message, state: FSMContext):
    await message.answer("Я обработчик сообщения")

    @dp.callback_query_handler(state=DialogMashine.one_state)
    async def one_state_callback(call, state: FSMContext):
    await bot.answer_callback_query(call.id)
    await call.message.answer("Я обработчик кнопки")



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2