thundra.button package

Submodules

thundra.button.registry module

class thundra.button.registry.ButtonEventData(**data)[source]

Bases: BaseModel, Generic[_ParamsButtonEvent]

expiration: datetime
id: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'expiration': FieldInfo(annotation=datetime, required=True), 'id': FieldInfo(annotation=str, required=True), 'on_click': FieldInfo(annotation=Callable[list, NoneType], required=True), 'params_type': FieldInfo(annotation=Union[Type[~_ParamsButtonEvent], NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

on_click: Callable[[TypeVar(_ParamsButtonEvent, bound= BaseModel)], None]
params_type: Optional[Type[TypeVar(_ParamsButtonEvent, bound= BaseModel)]]
class thundra.button.registry.ButtonRegistry(worker=5)[source]

Bases: Dict[str, ButtonEventData]

add(button)[source]
click(client, from_message)[source]
expire_run()[source]

thundra.button.types module

thundra.button.v1 module

class thundra.button.v1.CopyButton(**data)[source]

Bases: BaseModel

copy_code: str
create()[source]
Return type:

NativeFlowButton

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

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'copy_code': FieldInfo(annotation=str, required=True), 'display_text': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class thundra.button.v1.EmptyParams(**data)[source]

Bases: BaseModel

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

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class thundra.button.v1.ListButton(**data)[source]

Bases: BaseModel

create()[source]
Return type:

NativeFlowButton

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

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'sections': FieldInfo(annotation=List[Section], required=True), 'title': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

sections: List[Section]
title: str
class thundra.button.v1.QuickReply(**data)[source]

Bases: BaseModel, Generic[_ParamsButtonEvent]

create()[source]
Return type:

NativeFlowButton

create_event()[source]
display_text: str
expiration: datetime
id: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'display_text': FieldInfo(annotation=str, required=True), 'expiration': FieldInfo(annotation=datetime, required=False, default_factory=<lambda>), 'id': FieldInfo(annotation=str, required=False, default_factory=<lambda>), 'on_click': FieldInfo(annotation=Union[Callable[list, NoneType], Callable[list, NoneType]], required=True), 'params': FieldInfo(annotation=~_ParamsButtonEvent, required=False, default=EmptyParams())}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

on_click: Callable[[_ParamsButtonEvent], None] | Callable[[], None]
params: _ParamsButtonEvent
class thundra.button.v1.Row(**data)[source]

Bases: BaseModel, Generic[_ParamsButtonEvent]

create(id, idx, expiration, on_click)[source]
Return type:

Dict

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

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'description': FieldInfo(annotation=str, required=True), 'header': FieldInfo(annotation=str, required=True), 'params': FieldInfo(annotation=Union[~_ParamsButtonEvent, NoneType], required=False, default=None), 'title': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

params: Optional[_ParamsButtonEvent]
title: str
class thundra.button.v1.Section(**data)[source]

Bases: BaseModel, Generic[_ParamsButtonEvent]

add_option(*args)[source]
create()[source]
Return type:

Dict

expiration: datetime
highlight_label: str
id: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'expiration': FieldInfo(annotation=datetime, required=False, default_factory=<lambda>), 'highlight_label': FieldInfo(annotation=str, required=True), 'id': FieldInfo(annotation=str, required=False, default_factory=<lambda>), 'on_selected': FieldInfo(annotation=Union[Callable[list, NoneType], NoneType], required=False, default=None), 'rows': FieldInfo(annotation=List[Row], required=True), 'title': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

on_selected: Optional[Callable[[_ParamsButtonEvent], None]]
rows: List[Row[_ParamsButtonEvent]]
title: str

thundra.button.v2 module

class thundra.button.v2.EmptyParams(**data)[source]

Bases: BaseModel

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

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class thundra.button.v2.EventType[source]

Bases: object

get_quickreply_models()[source]
class thundra.button.v2.ListButtonV2(**data)[source]

Bases: BaseModel

create()[source]
Return type:

NativeFlowButton

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

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'sections': FieldInfo(annotation=List[SectionV2], required=True), 'title': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

sections: List[SectionV2]
title: str
class thundra.button.v2.QuickReplyV2(**data)[source]

Bases: ABC, BaseModel, Generic[_ParamsButtonEvent], EventType

create()[source]
display_text: str
event_id: ClassVar[str]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'display_text': FieldInfo(annotation=str, required=True), 'params': FieldInfo(annotation=~_ParamsButtonEvent, required=False, default=EmptyParams())}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

abstract on_click(client, message, params)[source]
Return type:

None

params: _ParamsButtonEvent
class thundra.button.v2.RowV2(**data)[source]

Bases: BaseModel, Generic[_ParamsButtonEvent]

create(event_id)[source]
description: str
header: str
id: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'description': FieldInfo(annotation=str, required=True), 'header': FieldInfo(annotation=str, required=True), 'id': FieldInfo(annotation=str, required=False, default=''), 'params': FieldInfo(annotation=~_ParamsButtonEvent, required=False, default=EmptyParams()), 'title': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

params: _ParamsButtonEvent
title: str
class thundra.button.v2.SectionV2(**data)[source]

Bases: ABC, BaseModel, Generic[_ParamsButtonEvent], EventType

create()[source]
event_id: ClassVar[str]
highlight_label: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'highlight_label': FieldInfo(annotation=str, required=True), 'rows': FieldInfo(annotation=List[RowV2], required=True), 'title': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

abstract on_click(client, message, param)[source]
rows: List[RowV2[_ParamsButtonEvent]]
title: str

Module contents

class thundra.button.CopyButton(**data)[source]

Bases: BaseModel

copy_code: str
create()[source]
Return type:

NativeFlowButton

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

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'copy_code': FieldInfo(annotation=str, required=True), 'display_text': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class thundra.button.ListButton(**data)[source]

Bases: BaseModel

create()[source]
Return type:

NativeFlowButton

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

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'sections': FieldInfo(annotation=List[Section], required=True), 'title': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

sections: List[Section]
title: str
class thundra.button.ListButtonV2(**data)[source]

Bases: BaseModel

create()[source]
Return type:

NativeFlowButton

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

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'sections': FieldInfo(annotation=List[SectionV2], required=True), 'title': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

sections: List[SectionV2]
title: str
class thundra.button.QuickReply(**data)[source]

Bases: BaseModel, Generic[_ParamsButtonEvent]

create()[source]
Return type:

NativeFlowButton

create_event()[source]
display_text: str
expiration: datetime
id: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'display_text': FieldInfo(annotation=str, required=True), 'expiration': FieldInfo(annotation=datetime, required=False, default_factory=<lambda>), 'id': FieldInfo(annotation=str, required=False, default_factory=<lambda>), 'on_click': FieldInfo(annotation=Union[Callable[list, NoneType], Callable[list, NoneType]], required=True), 'params': FieldInfo(annotation=~_ParamsButtonEvent, required=False, default=EmptyParams())}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

on_click: Callable[[_ParamsButtonEvent], None] | Callable[[], None]
params: _ParamsButtonEvent
class thundra.button.QuickReplyV2(**data)[source]

Bases: ABC, BaseModel, Generic[_ParamsButtonEvent], EventType

create()[source]
display_text: str
event_id: ClassVar[str]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'display_text': FieldInfo(annotation=str, required=True), 'params': FieldInfo(annotation=~_ParamsButtonEvent, required=False, default=EmptyParams())}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

abstract on_click(client, message, params)[source]
Return type:

None

params: _ParamsButtonEvent
class thundra.button.Row(**data)[source]

Bases: BaseModel, Generic[_ParamsButtonEvent]

create(id, idx, expiration, on_click)[source]
Return type:

Dict

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

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'description': FieldInfo(annotation=str, required=True), 'header': FieldInfo(annotation=str, required=True), 'params': FieldInfo(annotation=Union[~_ParamsButtonEvent, NoneType], required=False, default=None), 'title': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

params: Optional[_ParamsButtonEvent]
title: str
class thundra.button.RowV2(**data)[source]

Bases: BaseModel, Generic[_ParamsButtonEvent]

create(event_id)[source]
description: str
header: str
id: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'description': FieldInfo(annotation=str, required=True), 'header': FieldInfo(annotation=str, required=True), 'id': FieldInfo(annotation=str, required=False, default=''), 'params': FieldInfo(annotation=~_ParamsButtonEvent, required=False, default=EmptyParams()), 'title': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

params: _ParamsButtonEvent
title: str
class thundra.button.Section(**data)[source]

Bases: BaseModel, Generic[_ParamsButtonEvent]

add_option(*args)[source]
create()[source]
Return type:

Dict

expiration: datetime
highlight_label: str
id: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'expiration': FieldInfo(annotation=datetime, required=False, default_factory=<lambda>), 'highlight_label': FieldInfo(annotation=str, required=True), 'id': FieldInfo(annotation=str, required=False, default_factory=<lambda>), 'on_selected': FieldInfo(annotation=Union[Callable[list, NoneType], NoneType], required=False, default=None), 'rows': FieldInfo(annotation=List[Row], required=True), 'title': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

on_selected: Optional[Callable[[_ParamsButtonEvent], None]]
rows: List[Row[_ParamsButtonEvent]]
title: str
class thundra.button.SectionV2(**data)[source]

Bases: ABC, BaseModel, Generic[_ParamsButtonEvent], EventType

create()[source]
event_id: ClassVar[str]
highlight_label: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'highlight_label': FieldInfo(annotation=str, required=True), 'rows': FieldInfo(annotation=List[RowV2], required=True), 'title': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

abstract on_click(client, message, param)[source]
rows: List[RowV2[_ParamsButtonEvent]]
title: str
thundra.button.create_button_message(interactive_message, buttons, direct_send=True)[source]
Return type:

Message | InteractiveMessage

Return type:

Message