telega/keyboard
This module contains the keyboard constructors and usefull utilities to work with keyboards
Types
pub opaque type InlineKeyboard
pub type KeyboardCallback(data) {
KeyboardCallback(
id: String,
payload: String,
data: data,
callback_data: KeyboardCallbackData(data),
)
}
Constructors
-
KeyboardCallback( id: String, payload: String, data: data, callback_data: KeyboardCallbackData(data), )
pub opaque type KeyboardCallbackData(data)
Functions
pub fn build(keyboard: Keyboard) -> ReplyMarkup
Build a reply markup for Message
from a keyboard
pub fn build_inline(keyboard: InlineKeyboard) -> ReplyMarkup
Build a reply markup for Message
from an inline keyboard
pub fn filter_inline_keyboard_query(
keyboard: InlineKeyboard,
) -> CallbackQueryFilter
pub fn inline_button(
text text: String,
callback_data callback_data: KeyboardCallback(a),
) -> InlineKeyboardButton
Create a new inline button
pub fn new_callback_data(
id id: String,
serilize serilize: fn(a) -> String,
deserialize deserialize: fn(String) -> a,
) -> KeyboardCallbackData(a)
Create a new callback data for inline keyboard buttons
pub fn new_inline(
buttons: List(List(InlineKeyboardButton)),
) -> InlineKeyboard
Create a new inline keyboard
pub fn pack_callback(
callback_data callback_data: KeyboardCallbackData(a),
data data: a,
) -> KeyboardCallback(a)
Pack callback data into a callback
pub fn placeholder(keyboard: Keyboard, text: String) -> Keyboard
Set the placeholder for the input field
pub fn selected(keyboard: Keyboard) -> Keyboard
Make the keyboard selective. Use this parameter if you want to show the keyboard to specific users only.
pub fn set_callback_data_delimiter(
data: KeyboardCallbackData(a),
delimiter: String,
) -> KeyboardCallbackData(a)
Change the delimiter for the callback data, usefull if you need to use :
in the id
pub fn unpack_callback(
payload payload: String,
callback_data callback_data: KeyboardCallbackData(a),
) -> Result(KeyboardCallback(a), Nil)
Unpack payload into a callback