Button#
In simple case you can use keyboard consisting of single button. Button consts of text, id, on-click callback and when condition.
Text can be any Text
widget, that represents plain text. It will receive window data so your button will have dynamic caption
Callback is normal async function. It is called when user clicks a button Unlike normal handlers you should not call callback.answer(), as it is done automatically.
from aiogram.types import CallbackQuery
from aiogram_dialog import DialogManager
from aiogram_dialog.widgets.kbd import Button
from aiogram_dialog.widgets.text import Const
async def go_clicked(callback: CallbackQuery, button: Button,
manager: DialogManager):
await callback.message.answer("Going on!")
go_btn = Button(
Const("Go"),
id="go", # id is used to detect which button is clicked
on_click=go_clicked,
)
If it is unclear to you where to put button, check Quickstart