Class InlineKeyboardButton
java.lang.Object
io.github.natanimn.telebof.types.keyboard.InlineKeyboardButton
- All Implemented Interfaces:
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:
-
Constructor Summary
ConstructorsConstructorDescriptionInlineKeyboardButton(String text) RequiredInlineKeyboardButton(String text, String callbackData) -
Method Summary
Modifier and TypeMethodDescriptiongetPay()getText()getUrl()setCallbackGame(CallbackGame callbackGame) OptionalsetCopyText(CopyTextButton copyText) Optional.setLoginUrl(LoginUrl loginUrl) OptionalOptionalsetSwitchInlineQueryChosenChat(SwitchInlineQueryChosenChat switchInlineQueryChosenChat) OptionalsetSwitchInlineQueryCurrentChat(String switchInlineQueryCurrentChat) OptionalOptionalsetWebApp(WebAppInfo webApp) Optional
-
Constructor Details
-
InlineKeyboardButton
Required- Parameters:
text- Label text on the button
-
InlineKeyboardButton
- Parameters:
text- Required. Label text on the buttoncallbackData- Optional. Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes
-
-
Method Details
-
setUrl
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
-
setWebApp
Optional- Parameters:
webApp- 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
-
setLoginUrl
Optional- Parameters:
loginUrl- An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.- Returns:
InlineKeyboardButton
-
setSwitchInlineQueryCurrentChat
Optional- Parameters:
switchInlineQueryCurrentChat- 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
-
setCallbackGame
Optional- Parameters:
callbackGame- 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
-
setPay
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:
InlineKeyboardButton
-
setSwitchInlineQueryChosenChat
public InlineKeyboardButton setSwitchInlineQueryChosenChat(SwitchInlineQueryChosenChat switchInlineQueryChosenChat) Optional- Parameters:
switchInlineQueryChosenChat- 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
-
setCopyText
Optional.- Parameters:
copyText- Description of the button that copies the specified text to the clipboard.- Returns:
InlineKeyboardButton
-
getText
-
getUrl
-
getCallbackData
-
getSwitchInlineQueryCurrentChat
-
getWepApp
-
getLoginUrl
-
getPay
-
getCallbackGame
-
getSwitchInlineQueryChosenChat
-
getCopyText
-