peyk.platform_core.contracts

class peyk.platform_core.contracts.PlatformCapabilities(supports_topics: bool, supports_scheduled_messages: bool, update_delivery: ~typing.Literal['polling', 'webhook_only', 'both'], platform: str = 'custom', supported_parse_modes: list[str] = <factory>, callback_data_max_bytes: int | None = None, supports_payments: bool = False, supports_admin_detection: bool = False, supports_chat_member_status_updates: bool = False)[source]

Bases: object

PlatformCapabilities provides the platform-core API surface used by peyk.

callback_data_max_bytes: int | None = None
platform: str = 'custom'
supports_admin_detection: bool = False
supports_chat_member_status_updates: bool = False
supports_payments: bool = False
supports_topics: bool
supports_scheduled_messages: bool
update_delivery: Literal['polling', 'webhook_only', 'both']
supported_parse_modes: list[str]
class peyk.platform_core.contracts.IncomingMessage(message_id: int | str | None = None, chat_id: int | str | None = None, chat_type: str | None = None, sender_id: int | str | None = None, text: str | None = None, date: int | None = None, is_edited: bool = False, update_kind: str = 'message', reply_to_message_id: int | str | None = None, media: object = None, new_chat_members: list[int | str] | None = None, left_chat_member: int | str | None = None, successful_payment: object = None, raw: object = None)[source]

Bases: object

Normalized message surface shared by the three platform adapters.

IDs deliberately retain their source scalar type because Telegram/Bale use integers while Rubika uses string IDs. Missing source data remains None. raw always points at the exact source model instance.

chat_id: int | str | None = None
chat_type: str | None = None
date: int | None = None
is_edited: bool = False
left_chat_member: int | str | None = None
media: object = None
message_id: int | str | None = None
new_chat_members: list[int | str] | None = None
raw: object = None
reply_to_message_id: int | str | None = None
sender_id: int | str | None = None
successful_payment: object = None
text: str | None = None
update_kind: str = 'message'
class peyk.platform_core.contracts.IncomingMessageDeleted(chat_id: int | str | None = None, message_id: int | str | None = None, raw: object = None)[source]

Bases: object

A deletion event where the platform exposes no replacement message.

chat_id: int | str | None = None
message_id: int | str | None = None
raw: object = None
class peyk.platform_core.contracts.IncomingCallbackQuery(id: str | None = None, from_user_id: int | str | None = None, chat_id: int | str | None = None, message_id: int | str | None = None, inline_message_id: str | None = None, data: str | None = None, raw: object = None)[source]

Bases: object

Normalized inline/reply-button press.

Telegram/Bale callback_data and Rubika aux_data.button_id are both exposed as data. Rubika does not provide a callback-query ID, so its id is honestly None.

chat_id: int | str | None = None
data: str | None = None
from_user_id: int | str | None = None
id: str | None = None
inline_message_id: str | None = None
message_id: int | str | None = None
raw: object = None
class peyk.platform_core.contracts.IncomingPreCheckoutQuery(id: str | None = None, from_user_id: int | str | None = None, currency: str | None = None, total_amount: int | None = None, invoice_payload: str | None = None, shipping_option_id: str | None = None, order_info: object = None, raw: object = None)[source]

Bases: object

IncomingPreCheckoutQuery provides the platform-core API surface used by peyk.

currency: str | None = None
from_user_id: int | str | None = None
id: str | None = None
invoice_payload: str | None = None
order_info: object = None
raw: object = None
shipping_option_id: str | None = None
total_amount: int | None = None
class peyk.platform_core.contracts.IncomingShippingQuery(id: str | None = None, from_user_id: int | str | None = None, invoice_payload: str | None = None, shipping_address: object = None, raw: object = None)[source]

Bases: object

IncomingShippingQuery provides the platform-core API surface used by peyk.

from_user_id: int | str | None = None
id: str | None = None
invoice_payload: str | None = None
raw: object = None
shipping_address: object = None
class peyk.platform_core.contracts.IncomingChatMemberStatusUpdate(chat_id: int | str | None = None, actor_id: int | str | None = None, target_user_id: int | str | None = None, old_status: str | None = None, new_status: str | None = None, old_is_member: bool | None = None, new_is_member: bool | None = None, date: int | None = None, raw: object = None)[source]

Bases: object

Rich Telegram-style member status transition.

actor_id is optional by design; an adapter must never invent it.

actor_id: int | str | None = None
chat_id: int | str | None = None
date: int | None = None
new_is_member: bool | None = None
new_status: str | None = None
old_is_member: bool | None = None
old_status: str | None = None
raw: object = None
target_user_id: int | str | None = None
class peyk.platform_core.contracts.IncomingBotMembershipChange(chat_id: int | str | None = None, added: bool = False, actor_id: int | str | None = None, raw: object = None)[source]

Bases: object

Simple bot-added/bot-removed event.

Rubika provides this explicitly through EventData; Telegram/Bale can derive it from new/left chat-member message fields when the bot itself is the member mentioned there. actor_id remains optional.

actor_id: int | str | None = None
added: bool = False
chat_id: int | str | None = None
raw: object = None

Modules

callback

Normalized callback/button and payment-query contracts.

capabilities

Capabilities advertised by each platform adapter.

chat_member

Normalized membership-transition contracts.

message

Platform-neutral incoming message contracts.