The TeleverseMenu is a markup assist to create InlineKeyboards or Keyboards in an easy and efficient way.
For example, there will be many times you will have to show an Inline Keyboard to the user. And for all the callback queries received you might want to set up a handler by repeatedly using the bot.callbackQuery or a totally messy code with bot.onCallbackQuery.
Here comes Menus to rescue. The following is a simple example to illustrate its usage.
// Create the menu
final startMenu = InlineMenu(name: "Start Menu")
.text("Hello", helloCallback)
.row()
.text("Start", firstCallback)
.text("Finish", finishCallback);
And then we simply attach the menu to the bot and the bot will start listening for menu updates.
// Attach it to the bot
bot.attachMenu(startMenu);
After that, we'll show the menu to the user just like we show a Keyboard or InlineKeyboard.
// Start the bot and listen for /start command updates
bot.start((ctx) {
// Reply with the menu
ctx.reply(
"Hello, choose an option:",
replyMarkup: startMenu,
);
});
The TeleverseMenu is a markup assist to create InlineKeyboards or Keyboards in an easy and efficient way.
For example, there will be many times you will have to show an Inline Keyboard to the user. And for all the callback queries received you might want to set up a handler by repeatedly using the
bot.callbackQuery
or a totally messy code withbot.onCallbackQuery
.Here comes Menus to rescue. The following is a simple example to illustrate its usage.
And then we simply attach the menu to the bot and the bot will start listening for menu updates.
After that, we'll show the menu to the user just like we show a Keyboard or InlineKeyboard.
There we go, isn't that simple? 😉