Skip to content

Instantly share code, notes, and snippets.

@mkotb
Last active March 6, 2017 11:07
Show Gist options
  • Save mkotb/61a4256573a56ab207ed257c2564eb9b to your computer and use it in GitHub Desktop.
Save mkotb/61a4256573a56ab207ed257c2564eb9b 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();
@Polve
Copy link

Polve commented Mar 6, 2017

How to access this functionality from the client?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment