Cancel#
Cancel represents the button, on the click close current dialog.
from aiogram_dialog.widgets.kbd import Button
async def on_click(
cq: CallbackQuery,
button: Button,
dialog_manager: DialogManager
):
... # your actions
await dialog_manager.done()
button = Button(..., on_click=on_click)
Equal:
from aiogram_dialog.widgets.kbd import Button, Cancel
async def on_click(
cq: CallbackQuery,
button: Button,
dialog_manager: DialogManager
):
... # your actions
button = Cancel(..., on_click=on_click)
More: Transitions
Classes#
- class aiogram_dialog.widgets.kbd.state.Cancel(text=<aiogram_dialog.widgets.text.base.Const object>, id='__cancel__', result=None, on_click=None, when=None)#
- Parameters:
text (Text) –
id (str) –
result (Any) –
on_click (Callable[[CallbackQuery, Button, DialogManager], Awaitable] | None) –
when (str | MagicFilter | Predicate | None) –