Models¶
Note
Nearly all classes here have slots defined which means that it is impossible to have dynamic attributes to the data classes.
BaseView¶
View UI blocks
BaseView¶
- class slack.view.BaseView¶
Base class of view object.
This class carries abstract methods for all components.
New in version 1.4.0.
Placeholder¶
Select¶
- defto_dict
- class slack.view.Select¶
Represents a UI select menu with a list of custom options.
New in version 1.4.0.
- placeholder¶
Placeholder of select.
- Type:
Optional[
Placeholder]
- options¶
Options to selections. Some type must be this attribute to select.
- Type:
List[
SelectOption]
- select_type¶
Select type of this object.
- Type:
SelectOption¶
- defto_dict
- class slack.view.SelectOption¶
Option for select items.
New in version 1.4.0.
Enums¶
SelectType¶
- class slack.view.SelectType¶
Enums of select variety.
New in version 1.4.0.
ViewFrame¶
This is a frame of UI block.
ViewFrame¶
- class slack.view.ViewFrame¶
This class is base class for all components.
This class carries abstract methods for all components.
New in version 1.4.0.
View¶
- class slack.view.View¶
This is a frame of view block. All blocks contains this instance.
New in version 1.4.0.
- len(x)
Returns the total length of the blocks.
- bool(b)
Returns whether this has one or more blocks.
Example:
select = Select( action_id="action", placeholder=Placeholder( "text", mrkdwn=False, emoji=True), select_type=SelectType.users_select, initial_text="initial" ) view = View(select) await message.channel.send(view=view)
- add_block(block: Union[ActionView, SectionView]) View¶
Add block to the view object.
- Parameters:
block (Union[
ActionView,SectionView]) – Add block to this view object. Block must be inheritBaseView.- Returns:
Returns self object.
- Return type:
ActionView¶
- slack.view.ActionView¶
- class slack.view.ActionView¶
This class create action type instance.
New in version 1.4.2.
- to_dict()¶
It takes a list of blocks, and returns a dictionary with the key “elements” and the value of a list of dictionaries, where each dictionary is the result of calling the to_dict() method on each block
- Return type:
A dictionary with the key “type” and the value “actions”
SectionView¶
- slack.view.SectionView¶