Keyboard API

Platform-neutral keyboard IR, builders, and native renderers.

class peyk.keyboard.ButtonStyle(*values)[source]

Bases: str, Enum

ButtonStyle defines a public API type for peyk.

PRIMARY = 'primary'
SUCCESS = 'success'
DANGER = 'danger'
class peyk.keyboard.InlineButton(text: str, callback_data: str | CallbackData | None = None, url: str | None = None, web_app_url: str | None = None, web_app: object | None = None, copy_text: object | None = None, login_url: object | None = None, switch_inline_query: str | None = None, switch_inline_query_current_chat: str | None = None, switch_inline_query_chosen_chat: object | None = None, pay: bool | None = None, style: ButtonStyle | None = None, icon_custom_emoji_id: str | None = None, fallback: InlineButton | None = None)[source]

Bases: object

Platform-neutral inline button; platform rendering is deferred.

callback_data: str | CallbackData | None = None
copy_text: object | None = None
fallback: InlineButton | None = None
icon_custom_emoji_id: str | None = None
login_url: object | None = None
packed_callback_data() str | None[source]

Performs the packed callback data operation for the keyboard client.

Returns:

Result produced by the keyboard operation.

pay: bool | None = None
style: ButtonStyle | None = None
switch_inline_query: str | None = None
switch_inline_query_chosen_chat: object | None = None
switch_inline_query_current_chat: str | None = None
url: str | None = None
web_app: object | None = None
web_app_url: str | None = None
text: str
class peyk.keyboard.ReplyButton(text: str, request_contact: bool | None = None, request_location: bool | None = None, request_poll: object | None = None, request_users: object | None = None, request_chat: object | None = None, web_app_url: str | None = None, web_app: object | None = None, style: ButtonStyle | None = None, icon_custom_emoji_id: str | None = None, fallback: ReplyButton | None = None)[source]

Bases: object

Platform-neutral reply-keyboard button.

fallback: ReplyButton | None = None
icon_custom_emoji_id: str | None = None
request_chat: object | None = None
request_contact: bool | None = None
request_location: bool | None = None
request_poll: object | None = None
request_users: object | None = None
style: ButtonStyle | None = None
web_app: object | None = None
web_app_url: str | None = None
text: str
class peyk.keyboard.InlineKeyboard(inline_keyboard: tuple[tuple[InlineButton, ...], ...])[source]

Bases: object

Rows of neutral inline buttons.

inline_keyboard: tuple[tuple[InlineButton, ...], ...]
class peyk.keyboard.ReplyKeyboard(keyboard: tuple[tuple[ReplyButton, ...], ...], resize_keyboard: bool | None = None, one_time_keyboard: bool | None = None, input_field_placeholder: str | None = None, is_persistent: bool | None = None, selective: bool | None = None)[source]

Bases: object

Neutral reply keyboard and its presentation options.

input_field_placeholder: str | None = None
is_persistent: bool | None = None
one_time_keyboard: bool | None = None
resize_keyboard: bool | None = None
selective: bool | None = None
keyboard: tuple[tuple[ReplyButton, ...], ...]
class peyk.keyboard.KeyboardRemove(selective: bool | None = None)[source]

Bases: object

Neutral remove-keyboard instruction.

selective: bool | None = None
class peyk.keyboard.ForceReply(input_field_placeholder: str | None = None, selective: bool | None = None)[source]

Bases: object

Neutral force-reply instruction.

input_field_placeholder: str | None = None
selective: bool | None = None
class peyk.keyboard.InlineKeyboardBuilder[source]

Bases: _Builder[InlineButton]

Build an inline keyboard without selecting a platform.

as_markup(**options: object) InlineKeyboard[source]

Performs the as markup operation for the keyboard client.

Returns:

Result produced by the keyboard operation.

button(**fields: object) InlineKeyboardBuilder[source]

Performs the button operation for the keyboard client.

Returns:

Result produced by the keyboard operation.

classmethod from_markup(markup: InlineKeyboard) InlineKeyboardBuilder[source]

Performs the from markup operation for the keyboard client.

Parameters:

markup – Value used by this operation.

Returns:

Result produced by the keyboard operation.

class peyk.keyboard.ReplyKeyboardBuilder[source]

Bases: _Builder[ReplyButton]

Build a reply keyboard without selecting a platform.

as_markup(**options: object) ReplyKeyboard[source]

Performs the as markup operation for the keyboard client.

Returns:

Result produced by the keyboard operation.

button(**fields: object) ReplyKeyboardBuilder[source]

Performs the button operation for the keyboard client.

Returns:

Result produced by the keyboard operation.

classmethod from_markup(markup: ReplyKeyboard) ReplyKeyboardBuilder[source]

Performs the from markup operation for the keyboard client.

Parameters:

markup – Value used by this operation.

Returns:

Result produced by the keyboard operation.

peyk.keyboard.InlineKeyboardMarkup

alias of InlineKeyboard

peyk.keyboard.InlineKeyboardButton

alias of InlineButton

peyk.keyboard.ReplyKeyboardMarkup

alias of ReplyKeyboard

peyk.keyboard.KeyboardButton

alias of ReplyButton

peyk.keyboard.ReplyKeyboardRemove

alias of KeyboardRemove

class peyk.keyboard.Selection(text: str, button_id: str, selection_id: str = '', search_type: str = 'None', get_type: str = 'Local', items: tuple[object, ...] = (), is_multi_selection: bool = False, columns_count: str = '1', title: str | None = None)[source]

Bases: _RubikaButton

Selection provides the keyboard API surface used by peyk.

columns_count: str = '1'
get_type: str = 'Local'
is_multi_selection: bool = False
items: tuple[object, ...] = ()
search_type: str = 'None'
selection_id: str = ''
title: str | None = None
class peyk.keyboard.Calendar(text: str, button_id: str, default_value: str | None = None, type: str = 'DatePersian', min_year: str = '1300', max_year: str = '1450', title: str = '')[source]

Bases: _RubikaButton

Calendar provides the keyboard API surface used by peyk.

default_value: str | None = None
max_year: str = '1450'
min_year: str = '1300'
title: str = ''
type: str = 'DatePersian'
class peyk.keyboard.NumberPicker(text: str, button_id: str, min_value: str = '0', max_value: str = '100', default_value: str | None = None, title: str = '')[source]

Bases: _RubikaButton

NumberPicker provides the keyboard API surface used by peyk.

default_value: str | None = None
max_value: str = '100'
min_value: str = '0'
title: str = ''
class peyk.keyboard.StringPicker(text: str, button_id: str, items: tuple[str, ...] = (), default_value: str | None = None, title: str | None = None)[source]

Bases: _RubikaButton

StringPicker provides the keyboard API surface used by peyk.

default_value: str | None = None
items: tuple[str, ...] = ()
title: str | None = None
class peyk.keyboard.Location(text: str, button_id: str, default_pointer_location: object | None = None, default_map_location: object | None = None, type: str = 'Picker', title: str | None = None)[source]

Bases: _RubikaButton

Location provides the keyboard API surface used by peyk.

default_map_location: object | None = None
default_pointer_location: object | None = None
title: str | None = None
type: str = 'Picker'
class peyk.keyboard.CameraImage(text: str, button_id: str)[source]

Bases: _RubikaButton

CameraImage provides the keyboard API surface used by peyk.

class peyk.keyboard.CameraVideo(text: str, button_id: str)[source]

Bases: _RubikaButton

CameraVideo provides the keyboard API surface used by peyk.

class peyk.keyboard.GalleryImage(text: str, button_id: str)[source]

Bases: _RubikaButton

GalleryImage provides the keyboard API surface used by peyk.

class peyk.keyboard.GalleryVideo(text: str, button_id: str)[source]

Bases: _RubikaButton

GalleryVideo provides the keyboard API surface used by peyk.

class peyk.keyboard.File(text: str, button_id: str)[source]

Bases: _RubikaButton

File provides the keyboard API surface used by peyk.

class peyk.keyboard.Audio(text: str, button_id: str)[source]

Bases: _RubikaButton

Audio provides the keyboard API surface used by peyk.

class peyk.keyboard.RecordAudio(text: str, button_id: str)[source]

Bases: _RubikaButton

RecordAudio provides the keyboard API surface used by peyk.

class peyk.keyboard.Textbox(text: str, button_id: str, type_line: str = 'SingleLine', type_keypad: str = 'String', place_holder: str | None = None, title: str | None = None, default_value: str | None = None)[source]

Bases: _RubikaButton

Textbox provides the keyboard API surface used by peyk.

default_value: str | None = None
place_holder: str | None = None
title: str | None = None
type_keypad: str = 'String'
type_line: str = 'SingleLine'

Bases: _RubikaButton

Link provides the keyboard API surface used by peyk.

url: str = ''
class peyk.keyboard.AskMyPhoneNumber(text: str, button_id: str)[source]

Bases: _RubikaButton

AskMyPhoneNumber provides the keyboard API surface used by peyk.

class peyk.keyboard.AskMyLocation(text: str, button_id: str)[source]

Bases: _RubikaButton

AskMyLocation provides the keyboard API surface used by peyk.

class peyk.keyboard.Barcode(text: str, button_id: str)[source]

Bases: _RubikaButton

Barcode provides the keyboard API surface used by peyk.

class peyk.keyboard.builder.InlineKeyboardBuilder[source]

Bases: _Builder[InlineButton]

Build an inline keyboard without selecting a platform.

button(**fields: object) InlineKeyboardBuilder[source]

Performs the button operation for the keyboard client.

Returns:

Result produced by the keyboard operation.

as_markup(**options: object) InlineKeyboard[source]

Performs the as markup operation for the keyboard client.

Returns:

Result produced by the keyboard operation.

classmethod from_markup(markup: InlineKeyboard) InlineKeyboardBuilder[source]

Performs the from markup operation for the keyboard client.

Parameters:

markup – Value used by this operation.

Returns:

Result produced by the keyboard operation.

class peyk.keyboard.builder.ReplyKeyboardBuilder[source]

Bases: _Builder[ReplyButton]

Build a reply keyboard without selecting a platform.

button(**fields: object) ReplyKeyboardBuilder[source]

Performs the button operation for the keyboard client.

Returns:

Result produced by the keyboard operation.

as_markup(**options: object) ReplyKeyboard[source]

Performs the as markup operation for the keyboard client.

Returns:

Result produced by the keyboard operation.

classmethod from_markup(markup: ReplyKeyboard) ReplyKeyboardBuilder[source]

Performs the from markup operation for the keyboard client.

Parameters:

markup – Value used by this operation.

Returns:

Result produced by the keyboard operation.