SwitchTo

SwitchTo represents the button, on the click switches to the definite window in the same dialog.

from aiogram_dialog.widgets.kbd import Button

async def on_click(
        cq: CallbackQuery,
        button: Button,
        dialog_manager: DialogManager
):
    ...  # your actions
    await dialog_manager.switch_to(SOME_STATE)

button = Button(..., on_click=on_click)

Equal:

from aiogram_dialog.widgets.kbd import Button, SwitchTo

async def on_click(
        cq: CallbackQuery,
        button: Button,
        dialog_manager: DialogManager
):
    ...  # your actions

button = SwitchTo(..., state=SOME_STATE, on_click=on_click)

More: Transitions

Classes

class aiogram_dialog.widgets.kbd.state.SwitchTo(text, id, state, on_click=None, when=None, show_mode=None)
Parameters:
  • text (Text)

  • id (str)

  • state (State)

  • on_click (Callable[[CallbackQuery, Button, DialogManager], Awaitable] | None)

  • when (str | MagicFilter | Predicate | None)

  • show_mode (ShowMode | None)