Skip to content

Work with buttons

MohammadReza edited this page Jul 6, 2021 · 2 revisions

Flamingo provides a super simple way to build your keyboard ( Inline callback data & reply keyboard for now ), using following classes:

  • InlineBuilder
  • ReplyButton

InlineBuilder

This class takes a params set of Tuples! a two item tuple of (string, string) first one for text an second for data!

var btns = new InlineBuilder(("1.1", "1.1"));

You can add more!

var  btns = new InlineBuilder(
    ("1.1", "1.1"), ("1.2", "1.2"),
    ("2.1", "2.1"), ("2.2", "2.2"));

The buttons will be separate to 2 columns by default. But you can change it if you like

This buttons are all in one column!

var  btns = new InlineBuilder(1,
    ("1.1", "1.1"),
    ("1.2", "1.2"),
    ("2.1", "2.1"),
    ("2.2", "2.2"));

This one in 4 columns:

var  btns = new InlineBuilder(4,
    ("1.1", "1.1"), ("1.2", "1.2"), ("2.1", "2.1"), ("2.2", "2.2"));

ReplyButton

This is just like InlineBuilder, but it takes a params set of single string.

var btns = new ReplyButton("1.1");

var  btns = new ReplyButton(
    "1.1", "1.2",
    "2.1", "2.2");

// And more!

Use them

To use your buttons simply call .Markup.

await cdmt.ReplyText("Here are your buttons", replyMarkup: btns.Markup());

Examples

Keyboards Flamingo

Example to work with keyboards

Flamingo Framework written in pure c#, install from Nuget

Clone this wiki locally