This repository was archived by the owner on May 2, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Using keyboard markup builders
Mikhail edited this page Jan 10, 2021
·
3 revisions
Framework has built-in inline and reply keyboard builders for creating markups.
Currently, there is InlineKeyboardMarkupBuilder and ReplyKeyboardMarkupBuilder.
InlineKeyboardMarkupBuilder inlineKeyboardMarkupBuilder = InlineKeyboardMarkupBuilder.New;
InlineKeyboardMarkupBuilder.WithRow(
rowBuilder =>
{
rowBuilder.WithCallbackDataButton("Click Me!!!", "click_me_button")
});
InlineKeyboardMarkup inlineKeyboardMarkup = inlineKeyboardMarkupBuilder.Build();Here, inlineKeyboardMarkup will have one row, and one button called Click Me!!! with click_me_button callback data.
Both InlineKeyboardMarkupBuilder and ReplyKeyboardMarkupBuilder row builders implements static methods, which are contained in InlineKeyboardButton and ReplyKeyboardButton classes.
For example,
This is default button creation:
InlineKeyboardButton button = InlineKeyboardButton.WithCallbackData("Click Me!!!", "click_me_button");So, InlineKeyboardButton.WithCallbackData(...) became rowBuilder.WithCallbackDataButton(...).
All other methods are also implemented in this way. Method -> MethodButton.