-
-
Save DarkSeraphim/cf35feefc7bd3d0c18657c84b04ad385 to your computer and use it in GitHub Desktop.
Telegram Inline Menu Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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