Rubika API¶

The Rubika adapter follows the same one-symbol-per-file structure while keeping its webhook-security primitive as a coherent, separately auditable module.

Client¶

Rubika messenger bot platform adapter.

Standalone RubikaClient built directly on peyk.transport. Does NOT inherit from TelegramLikeClient – see docs/decisions.md for the R6 architectural conclusion, verified against the official rubika.ir/botapi documentation.

class peyk.platforms.rubika.RubikaClient(token: str, session: Session | None = None, *, retry_policy: RetryPolicy | None = None, logger: object = None, base_url: str | None = None)[source]¶

Bases: object

A typed asynchronous wrapper around the Rubika Bot API.

Rubika requests use wrapped response envelopes. File sending follows the audited three-step upload flow, and update polling uses Rubika’s offset_id cursor rather than Telegram’s numeric update offset.

__init__(token: str, session: Session | None = None, *, retry_policy: RetryPolicy | None = None, logger: object = None, base_url: str | None = None) None[source]¶

Initialize the client while preserving the original session ownership contract.

Parameters:
  • token – Rubika bot token.

  • session – Optional existing transport session.

  • retry_policy – Optional transport retry policy.

  • logger – Optional logger for a newly-created session.

  • base_url – Optional API base URL override.

Returns:

None.

async ban_chat_member(chat_id: str, user_id: str) bool¶

Performs the ban chat member operation for the Rubika client.

Parameters:
  • chat_id – Identifier of the target chat.

  • user_id – Identifier of the target user.

Returns:

Result produced by the Rubika operation.

base_url: str = 'https://botapi.rubika.ir/v3'¶
async close() None¶

Performs the close operation for the Rubika client.

async delete_message(chat_id: str, message_id: str) bool¶

Removes message through the Rubika API.

Parameters:
  • chat_id – Identifier of the target chat.

  • message_id – Identifier of the target message.

Returns:

Result produced by the Rubika operation.

async edit_chat_keypad(chat_id: str, chat_keypad: Keypad | Dict[str, object] | None = None, *, chat_keypad_type: str = ChatKeypadTypeEnum.NEW) bool¶

Edits chat keypad through the Rubika API.

Parameters:
  • chat_id – Identifier of the target chat.

  • chat_keypad – Value used by this operation.

  • chat_keypad_type – Value used by this operation.

Returns:

Result produced by the Rubika operation.

async edit_message_keypad(chat_id: str, message_id: str, inline_keypad: Keypad | Dict[str, object]) bool¶

Edits message keypad through the Rubika API.

Parameters:
  • chat_id – Identifier of the target chat.

  • message_id – Identifier of the target message.

  • inline_keypad – Value used by this operation.

Returns:

Result produced by the Rubika operation.

async edit_message_text(chat_id: str, message_id: str, text: str) bool¶

Edits message text through the Rubika API.

Parameters:
  • chat_id – Identifier of the target chat.

  • message_id – Identifier of the target message.

  • text – Text content supplied to the operation.

Returns:

Result produced by the Rubika operation.

async forward_message(from_chat_id: str, message_id: str, to_chat_id: str, *, disable_notification: bool | None = None) str¶

Performs the forward message operation for the Rubika client.

Parameters:
  • from_chat_id – Value used by this operation.

  • message_id – Identifier of the target message.

  • to_chat_id – Value used by this operation.

  • disable_notification – Value used by this operation.

Returns:

Result produced by the Rubika operation.

async get_chat(chat_id: str) Chat¶

Retrieves chat from the Rubika API.

Parameters:

chat_id – Identifier of the target chat.

Returns:

Result produced by the Rubika operation.

async get_file(file_id: str) str¶

Retrieves file from the Rubika API.

Parameters:

file_id – Identifier of the file.

Returns:

Result produced by the Rubika operation.

async get_me() Bot¶

Retrieves me from the Rubika API.

Returns:

Result produced by the Rubika operation.

async get_updates(*, offset_id: str | None = None, limit: int | None = None) Tuple[List[Update], str | None]¶

Retrieves updates from the Rubika API.

Parameters:
  • offset_id – Value used by this operation.

  • limit – Maximum number of results requested.

Returns:

Result produced by the Rubika operation.

async remove_chat_keypad(chat_id: str) bool¶

Removes chat keypad through the Rubika API.

Parameters:

chat_id – Identifier of the target chat.

Returns:

Result produced by the Rubika operation.

async request_send_file(type: str = FileTypeEnum.FILE) str¶

Performs the request send file operation for the Rubika client.

Parameters:

type – Value used by this operation.

Returns:

Result produced by the Rubika operation.

async send_contact(chat_id: str, first_name: str, last_name: str, phone_number: str, *, chat_keypad: Keypad | Dict[str, object] | None = None, inline_keypad: Keypad | Dict[str, object] | None = None, chat_keypad_type: str | None = None, reply_to_message_id: str | None = None, disable_notification: bool | None = None) Message¶

Sends contact through the Rubika API.

Parameters:
  • chat_id – Identifier of the target chat.

  • first_name – Value used by this operation.

  • last_name – Value used by this operation.

  • phone_number – Value used by this operation.

  • chat_keypad – Value used by this operation.

  • inline_keypad – Value used by this operation.

  • chat_keypad_type – Value used by this operation.

  • reply_to_message_id – Value used by this operation.

  • disable_notification – Value used by this operation.

Returns:

Result produced by the Rubika operation.

async send_file(chat_id: str, file_id: str, *, text: str | None = None, chat_keypad: Keypad | Dict[str, object] | None = None, inline_keypad: Keypad | Dict[str, object] | None = None, chat_keypad_type: str | None = None, reply_to_message_id: str | None = None, disable_notification: bool | None = None) Message¶

Sends file through the Rubika API.

Parameters:
  • chat_id – Identifier of the target chat.

  • file_id – Identifier of the file.

  • text – Text content supplied to the operation.

  • chat_keypad – Value used by this operation.

  • inline_keypad – Value used by this operation.

  • chat_keypad_type – Value used by this operation.

  • reply_to_message_id – Value used by this operation.

  • disable_notification – Value used by this operation.

Returns:

Result produced by the Rubika operation.

async send_location(chat_id: str, latitude: str, longitude: str, *, chat_keypad: Keypad | Dict[str, object] | None = None, inline_keypad: Keypad | Dict[str, object] | None = None, chat_keypad_type: str | None = None, reply_to_message_id: str | None = None, disable_notification: bool | None = None) Message¶

Sends location through the Rubika API.

Parameters:
  • chat_id – Identifier of the target chat.

  • latitude – Value used by this operation.

  • longitude – Value used by this operation.

  • chat_keypad – Value used by this operation.

  • inline_keypad – Value used by this operation.

  • chat_keypad_type – Value used by this operation.

  • reply_to_message_id – Value used by this operation.

  • disable_notification – Value used by this operation.

Returns:

Result produced by the Rubika operation.

async send_message(chat_id: str, text: str, *, metadata: Metadata | Dict[str, object] | None = None, chat_keypad: Keypad | Dict[str, object] | None = None, inline_keypad: Keypad | Dict[str, object] | None = None, chat_keypad_type: str | None = None, reply_to_message_id: str | None = None, disable_notification: bool | None = None) Message¶

Sends message through the Rubika API.

Parameters:
  • chat_id – Identifier of the target chat.

  • text – Text content supplied to the operation.

  • metadata – Value used by this operation.

  • chat_keypad – Value used by this operation.

  • inline_keypad – Value used by this operation.

  • chat_keypad_type – Value used by this operation.

  • reply_to_message_id – Value used by this operation.

  • disable_notification – Value used by this operation.

Returns:

Result produced by the Rubika operation.

async send_poll(chat_id: str, question: str, options: List[str]) Message¶

Sends poll through the Rubika API.

Parameters:
  • chat_id – Identifier of the target chat.

  • question – Value used by this operation.

  • options – Value used by this operation.

Returns:

Result produced by the Rubika operation.

async set_commands(commands: List[BotCommand | Dict[str, object]]) bool¶

Updates commands through the Rubika API.

Parameters:

commands – Value used by this operation.

Returns:

Result produced by the Rubika operation.

async unban_chat_member(chat_id: str, user_id: str) bool¶

Performs the unban chat member operation for the Rubika client.

Parameters:
  • chat_id – Identifier of the target chat.

  • user_id – Identifier of the target user.

Returns:

Result produced by the Rubika operation.

async update_bot_endpoints(url: str, type: str = UpdateEndpointTypeEnum.RECEIVE_UPDATE) bool¶

Performs the update bot endpoints operation for the Rubika client.

Parameters:
  • url – Target URL.

  • type – Value used by this operation.

Returns:

Result produced by the Rubika operation.

async upload_and_send_file(chat_id: str, file_bytes: bytes, *, file_type: str = FileTypeEnum.FILE, filename: str = 'file', content_type: str = 'application/octet-stream', text: str | None = None, **send_kwargs: object) Message¶

Performs the upload and send file operation for the Rubika client.

Parameters:
  • chat_id – Identifier of the target chat.

  • file_bytes – Value used by this operation.

  • file_type – Value used by this operation.

  • filename – Value used by this operation.

  • content_type – Value used by this operation.

  • text – Text content supplied to the operation.

Returns:

Result produced by the Rubika operation.

async upload_file(upload_url: str, file_bytes: bytes, *, filename: str = 'file', content_type: str = 'application/octet-stream') str¶

Performs the upload file operation for the Rubika client.

Parameters:
  • upload_url – Value used by this operation.

  • file_bytes – Value used by this operation.

  • filename – Value used by this operation.

  • content_type – Value used by this operation.

Returns:

Result produced by the Rubika operation.

exception peyk.platforms.rubika.RubikaAPIError(message: str, *, error_code: str, error_message: str, raw: dict | None = None)[source]¶

Bases: TransportError

Raised when a Rubika response has status != "OK".

peyk.platforms.rubika.error_for_envelope(envelope: dict) RubikaAPIError[source]¶

Performs the error for envelope operation for the Rubika client.

Parameters:

envelope – Value used by this operation.

Returns:

Result produced by the Rubika operation.

class peyk.platforms.rubika.ChatTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ChatTypeEnum.

The class preserves the existing public fields and wire-format behavior.

BOT = 'Bot'¶
CHANNEL = 'Channel'¶
GROUP = 'Group'¶
USER = 'User'¶
class peyk.platforms.rubika.FileTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for FileTypeEnum.

The class preserves the existing public fields and wire-format behavior.

FILE = 'File'¶
GIF = 'Gif'¶
IMAGE = 'Image'¶
MUSIC = 'Music'¶
VIDEO = 'Video'¶
VOICE = 'Voice'¶
class peyk.platforms.rubika.ForwardedFromEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ForwardedFromEnum.

The class preserves the existing public fields and wire-format behavior.

BOT = 'Bot'¶
CHANNEL = 'Channel'¶
USER = 'User'¶
class peyk.platforms.rubika.PollStatusEnum[source]¶

Bases: object

Provide the documented Rubika constant values for PollStatusEnum.

The class preserves the existing public fields and wire-format behavior.

CLOSED = 'Closed'¶
OPEN = 'Open'¶
class peyk.platforms.rubika.ButtonSelectionTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonSelectionTypeEnum.

The class preserves the existing public fields and wire-format behavior.

TEXT_IMG_BIG = 'TextImgBig'¶
TEXT_IMG_THU = 'TextImgThu'¶
TEXT_ONLY = 'TextOnly'¶
class peyk.platforms.rubika.ButtonSelectionSearchEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonSelectionSearchEnum.

The class preserves the existing public fields and wire-format behavior.

API = 'Api'¶
LOCAL = 'Local'¶
NONE = 'None'¶
class peyk.platforms.rubika.ButtonSelectionGetEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonSelectionGetEnum.

The class preserves the existing public fields and wire-format behavior.

API = 'Api'¶
LOCAL = 'Local'¶
class peyk.platforms.rubika.ButtonCalendarTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonCalendarTypeEnum.

The class preserves the existing public fields and wire-format behavior.

DATE_GREGORIAN = 'DateGregorian'¶
DATE_PERSIAN = 'DatePersian'¶
class peyk.platforms.rubika.ButtonTextboxTypeKeypadEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonTextboxTypeKeypadEnum.

The class preserves the existing public fields and wire-format behavior.

NUMBER = 'Number'¶
STRING = 'String'¶
class peyk.platforms.rubika.ButtonTextboxTypeLineEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonTextboxTypeLineEnum.

The class preserves the existing public fields and wire-format behavior.

MULTI_LINE = 'MultiLine'¶
SINGLE_LINE = 'SingleLine'¶
class peyk.platforms.rubika.ButtonLocationTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonLocationTypeEnum.

The class preserves the existing public fields and wire-format behavior.

PICKER = 'Picker'¶
VIEW = 'View'¶
class peyk.platforms.rubika.MessageSenderEnum[source]¶

Bases: object

Provide the documented Rubika constant values for MessageSenderEnum.

The class preserves the existing public fields and wire-format behavior.

BOT = 'Bot'¶
USER = 'User'¶
class peyk.platforms.rubika.UpdateTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for UpdateTypeEnum.

The class preserves the existing public fields and wire-format behavior.

EVENT_DATA = 'EventData'¶
NEW_MESSAGE = 'NewMessage'¶
REMOVED_MESSAGE = 'RemovedMessage'¶
STARTED_BOT = 'StartedBot'¶
STOPPED_BOT = 'StoppedBot'¶
UPDATED_MESSAGE = 'UpdatedMessage'¶
class peyk.platforms.rubika.ChatKeypadTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ChatKeypadTypeEnum.

The class preserves the existing public fields and wire-format behavior.

NEW = 'New'¶
NONE = 'None'¶
REMOVE = 'Remove'¶
class peyk.platforms.rubika.UpdateEndpointTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for UpdateEndpointTypeEnum.

The class preserves the existing public fields and wire-format behavior.

GET_SELECTION_ITEM = 'GetSelectionItem'¶
RECEIVE_INLINE_MESSAGE = 'ReceiveInlineMessage'¶
RECEIVE_QUERY = 'ReceiveQuery'¶
RECEIVE_UPDATE = 'ReceiveUpdate'¶
SEARCH_SELECTION_ITEMS = 'SearchSelectionItems'¶
class peyk.platforms.rubika.MetadataTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for MetadataTypeEnum.

The class preserves the existing public fields and wire-format behavior.

BOLD = 'Bold'¶
ITALIC = 'Italic'¶
MENTION_TEXT = 'MentionText'¶
MONO = 'Mono'¶
PRE = 'Pre'¶
QUOTE = 'Quote'¶
SPOILER = 'Spoiler'¶
STRIKE = 'Strike'¶
UNDERLINE = 'Underline'¶
class peyk.platforms.rubika.EnumChatAccess[source]¶

Bases: object

Provide the documented Rubika constant values for EnumChatAccess.

The class preserves the existing public fields and wire-format behavior.

BAN_MEMBER = 'BanMember'¶
DELETE_GLOBAL_ALL_MESSAGES = 'DeleteGlobalAllMessages'¶
EDIT_ALL_MESSAGES = 'EditAllMessages'¶
EDIT_MY_MESSAGES = 'EditMyMessages'¶
SEND_MESSAGES = 'SendMessages'¶
VIEW_MEMBERS = 'ViewMembers'¶
class peyk.platforms.rubika.EventTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for EventTypeEnum.

The class preserves the existing public fields and wire-format behavior.

BOT_JOINED = 'BotJoined'¶
BOT_PERMISSIONS_CHANGED = 'BotPermissionsChanged'¶
BOT_REMOVED = 'BotRemoved'¶
class peyk.platforms.rubika.EventJoinTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for EventJoinTypeEnum.

The class preserves the existing public fields and wire-format behavior.

ADMIN = 'Admin'¶
MEMBER = 'Member'¶
class peyk.platforms.rubika.ButtonTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonTypeEnum.

The class preserves the existing public fields and wire-format behavior.

ASK_MY_LOCATION = 'AskMyLocation'¶
ASK_MY_PHONE_NUMBER = 'AskMyPhoneNumber'¶
AUDIO = 'Audio'¶
BARCODE = 'Barcode'¶
CALENDAR = 'Calendar'¶
CAMERA_IMAGE = 'CameraImage'¶
CAMERA_VIDEO = 'CameraVideo'¶
FILE = 'File'¶
GALLERY_IMAGE = 'GalleryImage'¶
GALLERY_VIDEO = 'GalleryVideo'¶
LOCATION = 'Location'¶
NUMBER_PICKER = 'NumberPicker'¶
RECORD_AUDIO = 'RecordAudio'¶
SELECTION = 'Selection'¶
SIMPLE = 'Simple'¶
STRING_PICKER = 'StringPicker'¶
TEXTBOX = 'Textbox'¶
class peyk.platforms.rubika.AuxData(start_id: str | None = None, button_id: str | None = None)[source]¶

Bases: object

Callback data – carries the button that was pressed.

Confirmed from the docs’ receiveUpdate/receiveInlineMessage example bodies.

button_id: str | None = None¶
classmethod from_dict(data: dict | None) AuxData | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

start_id: str | None = None¶
class peyk.platforms.rubika.Bot(bot_id: str = '', bot_title: str = '', avatar: File | None = None, description: str | None = None, username: str | None = None, start_message: str | None = None, share_url: str | None = None)[source]¶

Bases: object

Represent the Rubika Bot API Bot type.

The class preserves the existing public fields and wire-format behavior.

avatar: File | None = None¶
bot_id: str = ''¶
bot_title: str = ''¶
description: str | None = None¶
classmethod from_dict(data: dict | None) Bot | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

share_url: str | None = None¶
start_message: str | None = None¶
username: str | None = None¶
class peyk.platforms.rubika.BotCommand(command: str = '', description: str = '')[source]¶

Bases: object

Represent the Rubika Bot API BotCommand type.

The class preserves the existing public fields and wire-format behavior.

command: str = ''¶
description: str = ''¶
classmethod from_dict(data: dict | None) BotCommand | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

to_dict() Dict[str, object][source]¶

Performs the to dict operation for the Rubika client.

Returns:

Result produced by the Rubika operation.

class peyk.platforms.rubika.Button(id: str = '', type: str = 'Simple', button_text: str = '', button_selection: ButtonSelection | None = None, button_calendar: ButtonCalendar | None = None, button_number_picker: ButtonNumberPicker | None = None, button_string_picker: ButtonStringPicker | None = None, button_location: ButtonLocation | None = None, button_textbox: ButtonTextbox | None = None)[source]¶

Bases: object

A single button.

Structure per the official docs: base fields (id, type, button_text) plus exactly one nested button_* object whose name depends on the type.

button_calendar: ButtonCalendar | None = None¶
button_location: ButtonLocation | None = None¶
button_number_picker: ButtonNumberPicker | None = None¶
button_selection: ButtonSelection | None = None¶
button_string_picker: ButtonStringPicker | None = None¶
button_text: str = ''¶
button_textbox: ButtonTextbox | None = None¶
classmethod from_dict(data: dict | None) Button | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

id: str = ''¶
to_dict() Dict[str, object][source]¶

Performs the to dict operation for the Rubika client.

Returns:

Result produced by the Rubika operation.

type: str = 'Simple'¶
class peyk.platforms.rubika.ButtonCalendar(default_value: str | None = None, type: str = 'DatePersian', min_year: str = '1300', max_year: str = '1450', title: str = '')[source]¶

Bases: object

Represent the Rubika Bot API ButtonCalendar type.

The class preserves the existing public fields and wire-format behavior.

default_value: str | None = None¶
classmethod from_dict(data: dict | None) ButtonCalendar | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

max_year: str = '1450'¶
min_year: str = '1300'¶
title: str = ''¶
to_dict() Dict[str, object][source]¶

Performs the to dict operation for the Rubika client.

Returns:

Result produced by the Rubika operation.

type: str = 'DatePersian'¶
class peyk.platforms.rubika.ButtonLocation(default_pointer_location: Location | None = None, default_map_location: Location | None = None, type: str = 'Picker', title: str | None = None)[source]¶

Bases: object

Represent the Rubika Bot API ButtonLocation type.

The class preserves the existing public fields and wire-format behavior.

default_map_location: Location | None = None¶
default_pointer_location: Location | None = None¶
classmethod from_dict(data: dict | None) ButtonLocation | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

title: str | None = None¶
to_dict() Dict[str, object][source]¶

Performs the to dict operation for the Rubika client.

Returns:

Result produced by the Rubika operation.

type: str = 'Picker'¶
class peyk.platforms.rubika.ButtonNumberPicker(min_value: str = '0', max_value: str = '100', default_value: str | None = None, title: str = '')[source]¶

Bases: object

Represent the Rubika Bot API ButtonNumberPicker type.

The class preserves the existing public fields and wire-format behavior.

default_value: str | None = None¶
classmethod from_dict(data: dict | None) ButtonNumberPicker | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

max_value: str = '100'¶
min_value: str = '0'¶
title: str = ''¶
to_dict() Dict[str, object][source]¶

Performs the to dict operation for the Rubika client.

Returns:

Result produced by the Rubika operation.

class peyk.platforms.rubika.ButtonSelection(selection_id: str = '', search_type: str = 'None', get_type: str = 'Local', items: List[ButtonSelectionItem] = <factory>, is_multi_selection: bool = False, columns_count: str = '1', title: Optional[str] = None)[source]¶

Bases: object

Represent the Rubika Bot API ButtonSelection type.

The class preserves the existing public fields and wire-format behavior.

columns_count: str = '1'¶
classmethod from_dict(data: dict | None) ButtonSelection | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

get_type: str = 'Local'¶
is_multi_selection: bool = False¶
search_type: str = 'None'¶
selection_id: str = ''¶
title: str | None = None¶
to_dict() Dict[str, object][source]¶

Performs the to dict operation for the Rubika client.

Returns:

Result produced by the Rubika operation.

items: List[ButtonSelectionItem]¶
class peyk.platforms.rubika.ButtonSelectionItem(text: str = '', image_url: str | None = None, type: str | None = None)[source]¶

Bases: object

Represent the Rubika Bot API ButtonSelectionItem type.

The class preserves the existing public fields and wire-format behavior.

classmethod from_dict(data: dict | None) ButtonSelectionItem | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

image_url: str | None = None¶
text: str = ''¶
to_dict() Dict[str, object][source]¶

Performs the to dict operation for the Rubika client.

Returns:

Result produced by the Rubika operation.

type: str | None = None¶
class peyk.platforms.rubika.ButtonStringPicker(items: ~typing.List[str] = <factory>, default_value: str | None = None, title: str | None = None)[source]¶

Bases: object

Represent the Rubika Bot API ButtonStringPicker type.

The class preserves the existing public fields and wire-format behavior.

default_value: str | None = None¶
classmethod from_dict(data: dict | None) ButtonStringPicker | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

title: str | None = None¶
to_dict() Dict[str, object][source]¶

Performs the to dict operation for the Rubika client.

Returns:

Result produced by the Rubika operation.

items: List[str]¶
class peyk.platforms.rubika.ButtonTextbox(type_line: str = 'SingleLine', type_keypad: str = 'String', place_holder: str | None = None, title: str | None = None, default_value: str | None = None)[source]¶

Bases: object

Represent the Rubika Bot API ButtonTextbox type.

The class preserves the existing public fields and wire-format behavior.

default_value: str | None = None¶
classmethod from_dict(data: dict | None) ButtonTextbox | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

place_holder: str | None = None¶
title: str | None = None¶
to_dict() Dict[str, object][source]¶

Performs the to dict operation for the Rubika client.

Returns:

Result produced by the Rubika operation.

type_keypad: str = 'String'¶
type_line: str = 'SingleLine'¶
class peyk.platforms.rubika.Chat(chat_id: str = '', chat_type: str = '', user_id: str | None = None, first_name: str | None = None, last_name: str | None = None, title: str | None = None, username: str | None = None)[source]¶

Bases: object

Represent the Rubika Bot API Chat type.

The class preserves the existing public fields and wire-format behavior.

chat_id: str = ''¶
chat_type: str = ''¶
first_name: str | None = None¶
classmethod from_dict(data: dict | None) Chat | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

last_name: str | None = None¶
title: str | None = None¶
user_id: str | None = None¶
username: str | None = None¶
class peyk.platforms.rubika.ContactMessage(phone_number: str | None = None, first_name: str | None = None, last_name: str | None = None)[source]¶

Bases: object

Represent the Rubika Bot API ContactMessage type.

The class preserves the existing public fields and wire-format behavior.

first_name: str | None = None¶
classmethod from_dict(data: dict | None) ContactMessage | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

last_name: str | None = None¶
phone_number: str | None = None¶
class peyk.platforms.rubika.Event(type: str | None = None, access_list: List[str] | None = None, join_type: str | None = None)[source]¶

Bases: object

Represent the Rubika Bot API Event type.

The class preserves the existing public fields and wire-format behavior.

access_list: List[str] | None = None¶
classmethod from_dict(data: dict | None) Event | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

join_type: str | None = None¶
type: str | None = None¶
class peyk.platforms.rubika.File(file_id: str = '', file_name: str | None = None, size: str | None = None)[source]¶

Bases: object

Represent the Rubika Bot API File type.

The class preserves the existing public fields and wire-format behavior.

file_id: str = ''¶
file_name: str | None = None¶
classmethod from_dict(data: dict | None) File | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

size: str | None = None¶
class peyk.platforms.rubika.ForwardedFrom(type_from: str | None = None, message_id: str | None = None, from_chat_id: str | None = None, from_sender_id: str | None = None)[source]¶

Bases: object

Represent the Rubika Bot API ForwardedFrom type.

The class preserves the existing public fields and wire-format behavior.

from_chat_id: str | None = None¶
classmethod from_dict(data: dict | None) ForwardedFrom | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

from_sender_id: str | None = None¶
message_id: str | None = None¶
type_from: str | None = None¶
class peyk.platforms.rubika.GetUpdatesResult(updates: List[Update] = <factory>, next_offset_id: Optional[str] = None)[source]¶

Bases: object

Wrapper for the getUpdates response payload.

Confirmed from the official docs: the data field carries both updates (list) and next_offset_id (the offset to pass on the next call).

classmethod from_data(data: object) GetUpdatesResult[source]¶

Performs the from data operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

next_offset_id: str | None = None¶
updates: List[Update]¶
class peyk.platforms.rubika.InlineMessage(sender_id: str = '', text: str | None = None, file: File | None = None, location: Location | None = None, aux_data: AuxData | None = None, message_id: str = '', chat_id: str = '')[source]¶

Bases: object

Represent the Rubika Bot API InlineMessage type.

The class preserves the existing public fields and wire-format behavior.

aux_data: AuxData | None = None¶
chat_id: str = ''¶
file: File | None = None¶
classmethod from_dict(data: dict | None) InlineMessage | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

location: Location | None = None¶
message_id: str = ''¶
sender_id: str = ''¶
text: str | None = None¶
class peyk.platforms.rubika.Keypad(rows: List[KeypadRow] = <factory>, resize_keyboard: Optional[bool] = None, one_time_keyboard: Optional[bool] = None)[source]¶

Bases: object

Represent the Rubika Bot API Keypad type.

The class preserves the existing public fields and wire-format behavior.

classmethod from_dict(data: dict | None) Keypad | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

one_time_keyboard: bool | None = None¶
resize_keyboard: bool | None = None¶
to_dict() Dict[str, object][source]¶

Performs the to dict operation for the Rubika client.

Returns:

Result produced by the Rubika operation.

rows: List[KeypadRow]¶
class peyk.platforms.rubika.KeypadRow(buttons: List[Button] = <factory>)[source]¶

Bases: object

Represent the Rubika Bot API KeypadRow type.

The class preserves the existing public fields and wire-format behavior.

classmethod from_dict(data: dict | None) KeypadRow | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

to_dict() Dict[str, object][source]¶

Performs the to dict operation for the Rubika client.

Returns:

Result produced by the Rubika operation.

buttons: List[Button]¶
class peyk.platforms.rubika.Location(latitude: str | None = None, longitude: str | None = None)[source]¶

Bases: object

Represent the Rubika Bot API Location type.

The class preserves the existing public fields and wire-format behavior.

classmethod from_dict(data: dict | None) Location | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

latitude: str | None = None¶
longitude: str | None = None¶
class peyk.platforms.rubika.Message(message_id: str = '', text: str | None = None, time: int | None = None, is_edited: bool = False, sender_type: str | None = None, sender_id: str | None = None, aux_data: AuxData | None = None, file: File | None = None, reply_to_message_id: str | None = None, forwarded_from: ForwardedFrom | None = None, forwarded_no_link: str | None = None, location: Location | None = None, sticker: Sticker | None = None, contact_message: ContactMessage | None = None, poll: Poll | None = None)[source]¶

Bases: object

Represent the Rubika Bot API Message type.

The class preserves the existing public fields and wire-format behavior.

aux_data: AuxData | None = None¶
contact_message: ContactMessage | None = None¶
file: File | None = None¶
forwarded_from: ForwardedFrom | None = None¶
classmethod from_dict(data: dict | None) Message | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

is_edited: bool = False¶
location: Location | None = None¶
message_id: str = ''¶
poll: Poll | None = None¶
reply_to_message_id: str | None = None¶
sender_id: str | None = None¶
sender_type: str | None = None¶
sticker: Sticker | None = None¶
text: str | None = None¶
time: int | None = None¶
class peyk.platforms.rubika.Metadata(meta_data_parts: List[MetadataPart] = <factory>)[source]¶

Bases: object

Represent the Rubika Bot API Metadata type.

The class preserves the existing public fields and wire-format behavior.

classmethod from_dict(data: dict | None) Metadata | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

to_dict() Dict[str, object][source]¶

Performs the to dict operation for the Rubika client.

Returns:

Result produced by the Rubika operation.

meta_data_parts: List[MetadataPart]¶
class peyk.platforms.rubika.MetadataPart(type: str = '', from_index: int = 0, length: int = 0, link_url: str | None = None, mention_text_user_id: str | None = None)[source]¶

Bases: object

Represent the Rubika Bot API MetadataPart type.

The class preserves the existing public fields and wire-format behavior.

classmethod from_dict(data: dict | None) MetadataPart | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

from_index: int = 0¶
length: int = 0¶
mention_text_user_id: str | None = None¶
to_dict() Dict[str, object][source]¶

Performs the to dict operation for the Rubika client.

Returns:

Result produced by the Rubika operation.

type: str = ''¶
class peyk.platforms.rubika.Poll(question: str = '', options: List[str] | None = None, poll_status: PollStatus | None = None)[source]¶

Bases: object

Represent the Rubika Bot API Poll type.

The class preserves the existing public fields and wire-format behavior.

classmethod from_dict(data: dict | None) Poll | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

options: List[str] | None = None¶
poll_status: PollStatus | None = None¶
question: str = ''¶
class peyk.platforms.rubika.PollStatus(state: str = 'Open', selection_index: int = -1, percent_vote_options: List[int] | None = None, total_vote: int = 0, show_total_votes: bool = False)[source]¶

Bases: object

Represent the Rubika Bot API PollStatus type.

The class preserves the existing public fields and wire-format behavior.

classmethod from_dict(data: dict | None) PollStatus | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

percent_vote_options: List[int] | None = None¶
selection_index: int = -1¶
show_total_votes: bool = False¶
state: str = 'Open'¶
total_vote: int = 0¶
class peyk.platforms.rubika.Sticker(sticker_id: str = '', file: File | None = None, emoji_character: str | None = None)[source]¶

Bases: object

Represent the Rubika Bot API Sticker type.

The class preserves the existing public fields and wire-format behavior.

emoji_character: str | None = None¶
file: File | None = None¶
classmethod from_dict(data: dict | None) Sticker | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

sticker_id: str = ''¶
class peyk.platforms.rubika.Update(type: str | None = None, chat_id: str | None = None, removed_message_id: str | None = None, new_message: Message | None = None, updated_message: Message | None = None, event_data: Event | None = None)[source]¶

Bases: object

Represent the Rubika Bot API Update type.

The class preserves the existing public fields and wire-format behavior.

chat_id: str | None = None¶
event_data: Event | None = None¶
classmethod from_dict(data: dict | None) Update | None[source]¶

Performs the from dict operation for the Rubika client.

Parameters:

data – Value used by this operation.

Returns:

Result produced by the Rubika operation.

new_message: Message | None = None¶
removed_message_id: str | None = None¶
type: str | None = None¶
updated_message: Message | None = None¶

Types and methods¶

peyk.platforms.rubika.types

Rubika API types, one public type per module.

peyk.platforms.rubika.methods

Rubika client methods, one module per method.

Enums and security¶

Rubika-specific finite constant domains.

class peyk.platforms.rubika.enums.ChatTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ChatTypeEnum.

The class preserves the existing public fields and wire-format behavior.

BOT = 'Bot'¶
CHANNEL = 'Channel'¶
GROUP = 'Group'¶
USER = 'User'¶
class peyk.platforms.rubika.enums.FileTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for FileTypeEnum.

The class preserves the existing public fields and wire-format behavior.

FILE = 'File'¶
GIF = 'Gif'¶
IMAGE = 'Image'¶
MUSIC = 'Music'¶
VIDEO = 'Video'¶
VOICE = 'Voice'¶
class peyk.platforms.rubika.enums.ForwardedFromEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ForwardedFromEnum.

The class preserves the existing public fields and wire-format behavior.

BOT = 'Bot'¶
CHANNEL = 'Channel'¶
USER = 'User'¶
class peyk.platforms.rubika.enums.PollStatusEnum[source]¶

Bases: object

Provide the documented Rubika constant values for PollStatusEnum.

The class preserves the existing public fields and wire-format behavior.

CLOSED = 'Closed'¶
OPEN = 'Open'¶
class peyk.platforms.rubika.enums.ButtonSelectionTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonSelectionTypeEnum.

The class preserves the existing public fields and wire-format behavior.

TEXT_IMG_BIG = 'TextImgBig'¶
TEXT_IMG_THU = 'TextImgThu'¶
TEXT_ONLY = 'TextOnly'¶
class peyk.platforms.rubika.enums.ButtonSelectionSearchEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonSelectionSearchEnum.

The class preserves the existing public fields and wire-format behavior.

API = 'Api'¶
LOCAL = 'Local'¶
NONE = 'None'¶
class peyk.platforms.rubika.enums.ButtonSelectionGetEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonSelectionGetEnum.

The class preserves the existing public fields and wire-format behavior.

API = 'Api'¶
LOCAL = 'Local'¶
class peyk.platforms.rubika.enums.ButtonCalendarTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonCalendarTypeEnum.

The class preserves the existing public fields and wire-format behavior.

DATE_GREGORIAN = 'DateGregorian'¶
DATE_PERSIAN = 'DatePersian'¶
class peyk.platforms.rubika.enums.ButtonTextboxTypeKeypadEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonTextboxTypeKeypadEnum.

The class preserves the existing public fields and wire-format behavior.

NUMBER = 'Number'¶
STRING = 'String'¶
class peyk.platforms.rubika.enums.ButtonTextboxTypeLineEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonTextboxTypeLineEnum.

The class preserves the existing public fields and wire-format behavior.

MULTI_LINE = 'MultiLine'¶
SINGLE_LINE = 'SingleLine'¶
class peyk.platforms.rubika.enums.ButtonLocationTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonLocationTypeEnum.

The class preserves the existing public fields and wire-format behavior.

PICKER = 'Picker'¶
VIEW = 'View'¶
class peyk.platforms.rubika.enums.MessageSenderEnum[source]¶

Bases: object

Provide the documented Rubika constant values for MessageSenderEnum.

The class preserves the existing public fields and wire-format behavior.

BOT = 'Bot'¶
USER = 'User'¶
class peyk.platforms.rubika.enums.UpdateTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for UpdateTypeEnum.

The class preserves the existing public fields and wire-format behavior.

EVENT_DATA = 'EventData'¶
NEW_MESSAGE = 'NewMessage'¶
REMOVED_MESSAGE = 'RemovedMessage'¶
STARTED_BOT = 'StartedBot'¶
STOPPED_BOT = 'StoppedBot'¶
UPDATED_MESSAGE = 'UpdatedMessage'¶
class peyk.platforms.rubika.enums.ChatKeypadTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ChatKeypadTypeEnum.

The class preserves the existing public fields and wire-format behavior.

NEW = 'New'¶
NONE = 'None'¶
REMOVE = 'Remove'¶
class peyk.platforms.rubika.enums.UpdateEndpointTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for UpdateEndpointTypeEnum.

The class preserves the existing public fields and wire-format behavior.

GET_SELECTION_ITEM = 'GetSelectionItem'¶
RECEIVE_INLINE_MESSAGE = 'ReceiveInlineMessage'¶
RECEIVE_QUERY = 'ReceiveQuery'¶
RECEIVE_UPDATE = 'ReceiveUpdate'¶
SEARCH_SELECTION_ITEMS = 'SearchSelectionItems'¶
class peyk.platforms.rubika.enums.MetadataTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for MetadataTypeEnum.

The class preserves the existing public fields and wire-format behavior.

BOLD = 'Bold'¶
ITALIC = 'Italic'¶
MENTION_TEXT = 'MentionText'¶
MONO = 'Mono'¶
PRE = 'Pre'¶
QUOTE = 'Quote'¶
SPOILER = 'Spoiler'¶
STRIKE = 'Strike'¶
UNDERLINE = 'Underline'¶
class peyk.platforms.rubika.enums.EnumChatAccess[source]¶

Bases: object

Provide the documented Rubika constant values for EnumChatAccess.

The class preserves the existing public fields and wire-format behavior.

BAN_MEMBER = 'BanMember'¶
DELETE_GLOBAL_ALL_MESSAGES = 'DeleteGlobalAllMessages'¶
EDIT_ALL_MESSAGES = 'EditAllMessages'¶
EDIT_MY_MESSAGES = 'EditMyMessages'¶
SEND_MESSAGES = 'SendMessages'¶
VIEW_MEMBERS = 'ViewMembers'¶
class peyk.platforms.rubika.enums.EventTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for EventTypeEnum.

The class preserves the existing public fields and wire-format behavior.

BOT_JOINED = 'BotJoined'¶
BOT_PERMISSIONS_CHANGED = 'BotPermissionsChanged'¶
BOT_REMOVED = 'BotRemoved'¶
class peyk.platforms.rubika.enums.EventJoinTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for EventJoinTypeEnum.

The class preserves the existing public fields and wire-format behavior.

ADMIN = 'Admin'¶
MEMBER = 'Member'¶
class peyk.platforms.rubika.enums.ButtonTypeEnum[source]¶

Bases: object

Provide the documented Rubika constant values for ButtonTypeEnum.

The class preserves the existing public fields and wire-format behavior.

ASK_MY_LOCATION = 'AskMyLocation'¶
ASK_MY_PHONE_NUMBER = 'AskMyPhoneNumber'¶
AUDIO = 'Audio'¶
BARCODE = 'Barcode'¶
CALENDAR = 'Calendar'¶
CAMERA_IMAGE = 'CameraImage'¶
CAMERA_VIDEO = 'CameraVideo'¶
FILE = 'File'¶
GALLERY_IMAGE = 'GalleryImage'¶
GALLERY_VIDEO = 'GalleryVideo'¶
LOCATION = 'Location'¶
NUMBER_PICKER = 'NumberPicker'¶
RECORD_AUDIO = 'RecordAudio'¶
SELECTION = 'Selection'¶
SIMPLE = 'Simple'¶
STRING_PICKER = 'StringPicker'¶
TEXTBOX = 'Textbox'¶

Backward-compatible import shim for webhook security helpers.

peyk.platforms.rubika.webhook_security.constant_time_compare(a: str | None, b: str | None) bool[source]¶

Compare two non-empty strings without ordinary early-exit timing.