telega/models/keyboard
Types
pub type InlineKeyboardButton {
InlineKeyboardButton(
text: String,
url: Option(String),
callback_data: Option(String),
switch_inline_query: Option(String),
switch_inline_query_current_chat: Option(String),
pay: Option(Bool),
)
}
Constructors
-
InlineKeyboardButton( text: String, url: Option(String), callback_data: Option(String), switch_inline_query: Option(String), switch_inline_query_current_chat: Option(String), pay: Option(Bool), )Official reference: https://core.telegram.org/bots/api#inlinekeyboardbutton
Arguments
-
text
Label text on the button
-
url
HTTP or
tg://URL to be opened when the button is pressed. Linkstg://user?id=<user_id>can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings. -
callback_data
Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
-
switch_inline_query
If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot’s username and the specified inline query in the input field. May be empty, in which case just the bot’s username will be inserted.
-
switch_inline_query_current_chat
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.
This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options.
-
pay
Specify True, to send a Pay button.
NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
-
Label text on the button
HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings.
Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot’s username and the specified inline query in the input field. May be empty, in which case just the bot’s username will be inserted.
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.
This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options. Specify True, to send a Pay button.
NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
pub type InlineKeyboardMarkup {
InlineKeyboardMarkup(
inline_keyboard: List(List(InlineKeyboardButton)),
)
}
Constructors
-
InlineKeyboardMarkup( inline_keyboard: List(List(InlineKeyboardButton)), )Official reference: https://core.telegram.org/bots/api#inlinekeyboardmarkup
Functions
pub fn decode_inline_button(
json: Dynamic,
) -> Result(InlineKeyboardButton, List(DecodeError))
pub fn decode_inline_markup(
json: Dynamic,
) -> Result(InlineKeyboardMarkup, List(DecodeError))