Button API Reference#
- class miru.button.Button(*, style: ~hikari.components.ButtonStyle = <ButtonStyle.PRIMARY: 1>, label: str | None = None, disabled: bool = False, custom_id: str | None = None, url: str | None = None, emoji: ~hikari.emojis.Emoji | str | None = None, row: int | None = None, position: int | None = None)[source]#
Bases:
ViewItemA view component representing a button.
- Parameters:
style (hikari.ButtonStyle, optional) – The button’s style, by default hikari.ButtonStyle.PRIMARY
label (Optional[str], optional) – The button’s label, by default None
disabled (bool, optional) – A boolean determining if the button should be disabled or not, by default False
custom_id (Optional[str], optional) – The custom identifier of the button, by default None
url (Optional[str], optional) – The URL of the button, by default None
emoji (Union[hikari.Emoji, str, None], optional) – The emoji present on the button, by default None
row (Optional[int], optional) – The row the button should be in, leave as None for auto-placement.
position (Optional[int], optional) – The position the button should be in within a row, leave as None for auto-placement.
- Raises:
- property style: ButtonStyle#
The button’s style.
- property type: ComponentType#
The component’s underlying component type.
- miru.button.button(*, label: t.Optional[str] = None, custom_id: t.Optional[str] = None, style: hikari.ButtonStyle = <ButtonStyle.PRIMARY: 1>, emoji: t.Optional[t.Union[str, hikari.Emoji]] = None, row: t.Optional[int] = None, disabled: bool = False) → t.Callable[[t.Callable[[ViewT, Button, ViewContextT], t.Awaitable[None]]], DecoratedItem[ViewT, Button, ViewContextT]][source]#
A decorator to transform a coroutine function into a Discord UI Button’s callback. This must be inside a subclass of View.
- Parameters:
label (Optional[str], optional) – The button’s label, by default None
custom_id (Optional[str], optional) – The button’s custom identifier, by default None
style (hikari.ButtonStyle, optional) – The style of the button, by default hikari.ButtonStyle.PRIMARY
emoji (Optional[Union[str, hikari.Emoji]], optional) – The emoji shown on the button, by default None
row (Optional[int], optional) – The row the button should be in, leave as None for auto-placement.
disabled (bool, optional) – A boolean determining if the button should be disabled or not, by default False
- Returns:
The decorated callback function.
- Return type:
Callable[[Callable[[ViewT, Button, ViewContextT], Awaitable[None]]], DecoratedItem[ViewT, Button, ViewContextT]]