bostie.ui¶
bostie.ui
¶
ButtonStyle
¶
Bases: DiscordIntEnum
TextInputStyle
¶
Bases: DiscordIntEnum
SelectOptionDict
¶
ThumbnailDict
¶
GalleryItemDict
¶
FileDict
¶
SeparatorDict
¶
ContainerDict
¶
GroupOptionDict
¶
CheckboxDict
¶
LabelDict
¶
ModalDict
¶
raw
¶
raw(component: Mapping[str, Any]) -> RawComponent
A component ui has no builder for, sent as given.
row
¶
An action row holding up to five buttons or one select menu.
button
¶
button(label: str | None, *, custom_id: str, style: InteractiveStyle = SECONDARY, emoji: AnyEmoji | None = None, disabled: bool = False, id: int | None = None) -> ButtonDict
A button that sends custom_id to the bot when clicked.
pager
¶
Previous and next buttons around "page / count" for a {page:int} route.
Each button's custom_id is route.id(page=..., **params), so pages survive a
restart; the first page is 0.
link_button
¶
link_button(label: str | None, url: str, *, emoji: AnyEmoji | None = None, disabled: bool = False, id: int | None = None) -> ButtonDict
A button that opens url and never reaches the bot.
premium_button
¶
premium_button(sku_id: int, *, disabled: bool = False, id: int | None = None) -> ButtonDict
A button that offers the SKU sku_id for sale and never reaches the bot.
string_select
¶
string_select(custom_id: str, options: Iterable[SelectOptionDict], *, placeholder: str | None = None, min_values: int = 1, max_values: int = 1, required: bool = True, disabled: bool = False, id: int | None = None) -> StringSelectDict
A select menu of fixed options; build them with select_option.
user_select
¶
user_select(custom_id: str, *, defaults: Iterable[int] = (), placeholder: str | None = None, min_values: int = 1, max_values: int = 1, required: bool = True, disabled: bool = False, id: int | None = None) -> EntitySelectDict
A select menu of users; defaults are the ids of users shown as chosen.
role_select
¶
role_select(custom_id: str, *, defaults: Iterable[int] = (), placeholder: str | None = None, min_values: int = 1, max_values: int = 1, required: bool = True, disabled: bool = False, id: int | None = None) -> EntitySelectDict
A select menu of roles; defaults are the ids of roles shown as chosen.
mentionable_select
¶
mentionable_select(custom_id: str, *, default_users: Iterable[int] = (), default_roles: Iterable[int] = (), placeholder: str | None = None, min_values: int = 1, max_values: int = 1, required: bool = True, disabled: bool = False, id: int | None = None) -> EntitySelectDict
A select menu of users and roles, with these ids shown as chosen.
channel_select
¶
channel_select(custom_id: str, *, channel_types: Iterable[ChannelType] = (), defaults: Iterable[int] = (), placeholder: str | None = None, min_values: int = 1, max_values: int = 1, required: bool = True, disabled: bool = False, id: int | None = None) -> EntitySelectDict
A select menu of channels, of channel_types only when given.
select_option
¶
select_option(label: str, value: str, *, description: str | None = None, emoji: AnyEmoji | None = None, default: bool = False) -> SelectOptionDict
One entry of a select menu; value is what the bot receives.
text
¶
Markdown text; Components V2 messages use it instead of content.
section
¶
section(*texts: TextDict | RawComponent, accessory: ButtonDict | ThumbnailDict | RawComponent, id: int | None = None) -> SectionDict
One to three text components with a button or thumbnail beside them.
thumbnail
¶
thumbnail(url: str, *, description: str | None = None, spoiler: bool = False, id: int | None = None) -> ThumbnailDict
A small image for a section; url may be attachment://<filename>.
media_gallery
¶
media_gallery(*items: GalleryItemDict | RawComponent, id: int | None = None) -> MediaGalleryDict
One to ten images or videos built with gallery_item.
gallery_item
¶
gallery_item(url: str, *, description: str | None = None, spoiler: bool = False) -> GalleryItemDict
One entry of a media_gallery; url may be attachment://<filename>.
file
¶
A file uploaded with the message, named as in its File.
separator
¶
separator(*, divider: bool = True, spacing: Literal[1, 2] = 1, id: int | None = None) -> SeparatorDict
Space between components; spacing=2 is large, and divider draws a line.
container
¶
container(*components: _ContainerChild, accent_color: int | None = None, spoiler: bool = False, id: int | None = None) -> ContainerDict
A box around rows, texts, sections, galleries, files and separators.
modal
¶
A popup form of one to five label and text components.
label
¶
label(label: str, component: _LabelChild, *, description: str | None = None, id: int | None = None) -> LabelDict
A modal field: label and description over one input, select or upload.
text_input
¶
text_input(custom_id: str, *, style: TextInputStyle = SHORT, placeholder: str | None = None, value: str | None = None, min_length: int | None = None, max_length: int | None = None, required: bool = True, id: int | None = None) -> TextInputDict
A text box in a label; value fills it in beforehand.
file_upload
¶
file_upload(custom_id: str, *, min_values: int = 1, max_values: int = 1, required: bool = True, file_types: Iterable[str] = (), id: int | None = None) -> FileUploadDict
Up to ten files uploaded in a label; file_types such as "image" or ".pdf".
radio_group
¶
radio_group(custom_id: str, options: Iterable[GroupOptionDict], *, required: bool = True, id: int | None = None) -> RadioGroupDict
Two to ten options in a label, of which one is picked.
checkbox_group
¶
checkbox_group(custom_id: str, options: Iterable[GroupOptionDict], *, min_values: int = 1, max_values: int | None = None, required: bool = True, id: int | None = None) -> CheckboxGroupDict
Checkboxes in a label; without max_values all of them can be ticked.
group_option
¶
group_option(label: str, value: str, *, description: str | None = None, default: bool = False) -> GroupOptionDict
One entry of a radio_group or checkbox_group.
checkbox
¶
checkbox(custom_id: str, *, default: bool = False, id: int | None = None) -> CheckboxDict
A single yes or no box in a label.