Class InlineKeyboardButton

java.lang.Object
io.github.natanimn.telebof.types.keyboard.InlineKeyboardButton
All Implemented Interfaces:
Serializable

public class InlineKeyboardButton extends Object implements Serializable
This object represents one button of an inline keyboard. Exactly one of the optional fields must be used to specify type of the button.
Since:
3 March 2025
See Also:
  • Field Details

  • Constructor Details

    • InlineKeyboardButton

      public InlineKeyboardButton(String text)
      Required
      Parameters:
      text - Label text on the button
    • InlineKeyboardButton

      public InlineKeyboardButton(String text, String callback_data)
      Parameters:
      text - Required. Label text on the button
      callback_data - Optional. Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes
  • Method Details

    • url

      public InlineKeyboardButton url(String url)
      Optional
      Parameters:
      url - HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id= can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings.
      Returns:
      InlineKeyboardButton
    • webApp

      public InlineKeyboardButton webApp(WebAppInfo web_app)
      Optional
      Parameters:
      web_app - Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a Telegram Business account.
      Returns:
      InlineKeyboardButton
    • loginUrl

      public InlineKeyboardButton loginUrl(LoginUrl login_url)
      Optional
      Parameters:
      login_url - An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.
      Returns:
      InlineKeyboardButton
    • switchInlineQueryCurrentChat

      public InlineKeyboardButton switchInlineQueryCurrentChat(String switch_inline_query_current_chat)
      Optional
      Parameters:
      switch_inline_query_current_chat - If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted.
      Returns:
      InlineKeyboardButton
    • callbackGame

      public InlineKeyboardButton callbackGame(CallbackGame callback_game)
      Optional
      Parameters:
      callback_game - Description of the game that will be launched when the user presses the button.
      NOTE: This type of button must always be the first button in the first row.
      Returns:
      InlineKeyboardButton
    • pay

      public InlineKeyboardButton pay(boolean pay)
      Optional
      Parameters:
      pay - Specify True, to send a Pay button. Substrings “⭐” and “XTR” in the buttons's text will be replaced with a Telegram Star icon.
      NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
      Returns:
    • switchInlineQueryChosenChat

      public InlineKeyboardButton switchInlineQueryChosenChat(SwitchInlineQueryChosenChat switch_inline_query_chosen_chat)
      Optional
      Parameters:
      switch_inline_query_chosen_chat - If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field. Not supported for messages sent on behalf of a Telegram Business account.
      Returns:
      InlineKeyboardButton
    • copyText

      public InlineKeyboardButton copyText(CopyTextButton copy_text)
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object