Telegram Message#

This module implements inherited classes dff.script.core.message modified for usage with Telegram.

class TelegramUI(**data)[source]#

Bases: Keyboard

is_inline: bool#

Whether to use inline keyboard or a keyboard.

row_width: int#

Limits the maximum number of buttons in a row.

validate_buttons(_)[source]#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class _ClickButton(**data)[source]#

Bases: DataModel

This class is only used in telegram tests (to click buttons as a client).

button_index: int#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RemoveKeyboard(**data)[source]#

Bases: DataModel

Pass an instance of this class to ui to remove current keyboard.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ParseMode(value)[source]#

Bases: Enum

Parse mode of the message. More info: https://core.telegram.org/bots/api#formatting-options.

HTML = 'HTML'#
MARKDOWN = 'MarkdownV2'#
class TelegramMessage(text=None, commands=None, attachments=None, annotations=None, misc=None, **kwargs)[source]#

Bases: Message

ui: Union[TelegramUI, RemoveKeyboard, ReplyKeyboardRemove, ReplyKeyboardMarkup, InlineKeyboardMarkup, None]#
location: Optional[Location]#
callback_query: Union[str, _ClickButton, None]#
update: Union[Message, InlineQuery, ChosenInlineResult, CallbackQuery, ShippingQuery, PreCheckoutQuery, Poll, PollAnswer, ChatMemberUpdated, ChatJoinRequest, None]#

This field stores an update representing this message.

update_id: Optional[int]#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

update_type: Optional[str]#

Name of the field that stores an update representing this message.

parse_mode: Optional[ParseMode]#

Parse mode of the message.