Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't use TextInput along with processing messages in aiogram. #461

Open
elter-tef opened this issue Jan 26, 2025 · 1 comment
Open

I can't use TextInput along with processing messages in aiogram. #461

elter-tef opened this issue Jan 26, 2025 · 1 comment

Comments

@elter-tef
Copy link

I have a dialog with a window that has a TextInput

Window(
        Format("{step_question}"),
        TextInput(id="step_answer", on_success=step_question_text_handler),
        Cancel(),
        state=CreateFormSG.question_step,
        getter=step_question_getter,

and also has the processing of all text messages in aiogram

@dp.message(F.text)
async def start(tg_message: types.Message, dialog_manager: DialogManager, db_session: AsyncSession, db_user: User, state: FSMContext):
    print(await state.get_state())
    print('aiogram text handler')

Expected behavior: When using the dialog, messages will end up in step_question_text_handler ( as i think because state==CreateFormSG.question_step ).

Current behavior: When using the dialog, messages end up in all messages handler with state==None

None
aiogram text handler

Is this a bug or am I doing something wrong?

Name: aiogram_dialog
Version: 2.3.0

Name: aiogram
Version: 3.17.0
@Tishka17
Copy link
Owner

When dialog is open it handles all input regardless if Message input widget is provided. The expected behavior is: if you have no input in dialog, probably you have no input at all and we just need to ensure user sees the dialog.

Anyway, you can catch all messages with specific text just inlcuding their router above the dialog router

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants