Skip to content

Instantly share code, notes, and snippets.

@DarkSeraphim
Forked from mkotb/example.java
Created October 19, 2016 17:05
Show Gist options
  • Save DarkSeraphim/cf35feefc7bd3d0c18657c84b04ad385 to your computer and use it in GitHub Desktop.
Save DarkSeraphim/cf35feefc7bd3d0c18657c84b04ad385 to your computer and use it in GitHub Desktop.
Telegram Inline Menu Example
InlineMenuBuilder builder = InlineMenu.builder(bot, event.getChat())
.allowedUser(event.getMessage().getSender())
.message(SendableTextMessage.markdown("*Cool Message*"))
.newRow()
.toggleButton()
.toggleCallback((button, newValue) -> "The value is " + newValue)
.newRow()
.inputButton("Click for name")
.buttonCallback((button) -> "Send me your name as a text!")
.textCallback((button, input) -> button.setText("Your name is " + input))
.buildRow();
InlineMenu subMenu = builder.subMenu()
.newRow()
.toggleButton("Give me emoji!")
.toggleCallback((button, newValue) -> newValue ? "\uD83D\uDC4D" : "\uD83D\uDC4E")
.newRow()
.backButton("Go back")
.buildMenu();
builder
.newRow()
.menuButton("Sub Menu")
.nextMenu(subMenu)
.buildMenu()
.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment