Next and Back#

Next and Back represents the buttons, on the click switches forward and backward by dialog accordingly.

from aiogram_dialog.widgets.kbd import Button

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

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

Equal:

from aiogram_dialog.widgets.kbd import Button, Next  # or Back

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

button = Next(..., on_click=on_click)  # or Back

More: Transitions

Classes#

class aiogram_dialog.widgets.kbd.state.Next(text=<aiogram_dialog.widgets.text.base.Const object>, id='__next__', on_click=None, when=None)#
Parameters:
  • text (Text) –

  • id (str) –

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

  • when (str | MagicFilter | Predicate | None) –

class aiogram_dialog.widgets.kbd.state.Back(text=<aiogram_dialog.widgets.text.base.Const object>, id='__back__', on_click=None, when=None)#
Parameters:
  • text (Text) –

  • id (str) –

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

  • when (str | MagicFilter | Predicate | None) –