Screen Items API Reference#

class miru.ext.menu.items.ScreenButton(*, 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: Button, ScreenItem

A base class for all screen buttons.

class miru.ext.menu.items.ScreenChannelSelect(*, channel_types: ~typing.Sequence[~hikari.channels.ChannelType] = (<ChannelType.GUILD_TEXT: 0>, ), custom_id: str | None = None, placeholder: str | None = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: int | None = None)[source]#

Bases: ChannelSelect, ScreenItem

A base class for all screen channel selects.

class miru.ext.menu.items.ScreenItem(*, custom_id: str | None = None, row: int | None = None, position: int | None = None, disabled: bool = False, width: int = 1)[source]#

Bases: ViewItem, ABC

A baseclass for all screen items. Screen requires instances of this class as it’s items.

property menu: Menu#

The menu this item is attached to. Alias for view.

property screen: Screen#

The screen this item is attached to.

property view: Menu#

The view this item is attached to.

class miru.ext.menu.items.ScreenMentionableSelect(*, custom_id: str | None = None, placeholder: str | None = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: int | None = None)[source]#

Bases: MentionableSelect, ScreenItem

A base class for all screen mentionable selects.

class miru.ext.menu.items.ScreenRoleSelect(*, custom_id: str | None = None, placeholder: str | None = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: int | None = None)[source]#

Bases: RoleSelect, ScreenItem

A base class for all screen role selects.

class miru.ext.menu.items.ScreenTextSelect(*, options: Sequence[SelectMenuOption | SelectOption], custom_id: str | None = None, placeholder: str | None = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: int | None = None)[source]#

Bases: TextSelect, ScreenItem

A base class for all screen text selects.

class miru.ext.menu.items.ScreenUserSelect(*, custom_id: str | None = None, placeholder: str | None = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: int | None = None)[source]#

Bases: UserSelect, ScreenItem

A base class for all screen user selects.

miru.ext.menu.items.button(*, label: str | None = None, custom_id: str | None = None, style: ~hikari.components.ButtonStyle = <ButtonStyle.PRIMARY: 1>, emoji: str | ~hikari.emojis.Emoji | None = None, row: int | None = None, disabled: bool = False) Callable[[Callable[[ScreenT, ScreenButton, ViewContextT], Awaitable[None]]], DecoratedScreenItem[ScreenT, ScreenButton, ViewContextT]][source]#

A decorator to transform a coroutine function into a Discord UI Button’s callback. This must be inside a subclass of Screen.

Parameters:
  • label (Optional[str], optional) – The button’s label, by default None

  • custom_id (Optional[str], optional) – The button’s custom ID, 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 coroutine function.

Return type:

Callable[[Callable[[ScreenT, ScreenButton, ViewContextT], Awaitable[None]]], DecoratedScreenItem[ScreenT, ScreenButton, ViewContextT]]

Raises:

TypeError – If the decorated function is not a coroutine function.

miru.ext.menu.items.channel_select(*, channel_types: ~typing.Sequence[~hikari.channels.ChannelType] = (<ChannelType.GUILD_TEXT: 0>, ), custom_id: str | None = None, placeholder: str | None = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: int | None = None) Callable[[Callable[[ScreenT, ScreenChannelSelect, ViewContextT], Awaitable[None]]], DecoratedScreenItem[ScreenT, ScreenChannelSelect, ViewContextT]][source]#

A decorator to transform a function into a Discord UI ChannelSelectMenu’s callback. This must be inside a subclass of Screen.

Parameters:
  • channel_types (Sequence[hikari.ChannelType], optional) – A sequence of channel types to filter the select menu by. Defaults to (hikari.ChannelType.GUILD_TEXT,).

  • custom_id (Optional[str], optional) – The custom ID for the select menu. Defaults to None.

  • placeholder (Optional[str], optional) – The placeholder text for the channel select menu. Defaults to None.

  • min_values (int, optional) – The minimum number of values that can be selected. Defaults to 1.

  • max_values (int, optional) – The maximum number of values that can be selected. Defaults to 1.

  • disabled (bool, optional) – Whether the channel select menu is disabled or not. Defaults to False.

  • row (Optional[int], optional) – The row the select should be in, leave as None for auto-placement.

Returns:

The decorated function.

Return type:

Callable[[Callable[[ScreenT, ScreenChannelSelect, ViewContextT], Awaitable[None]]], DecoratedScreenItem[ScreenT, ScreenChannelSelect, ViewContextT]]

Raises:

TypeError – If the decorated function is not a coroutine function.

miru.ext.menu.items.mentionable_select(*, custom_id: str | None = None, placeholder: str | None = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: int | None = None) Callable[[Callable[[ScreenT, ScreenMentionableSelect, ViewContextT], Awaitable[None]]], DecoratedScreenItem[ScreenT, ScreenMentionableSelect, ViewContextT]][source]#

A decorator to transform a function into a Discord UI MentionableSelectMenu’s callback. This must be inside a subclass of Screen.

Parameters:
  • custom_id (Optional[str], optional) – The custom ID for the select menu, by default None

  • placeholder (Optional[str], optional) – The placeholder text to display when no option is selected, by default None

  • min_values (int, optional) – The minimum number of values that can be selected, by default 1

  • max_values (int, optional) – The maximum number of values that can be selected, by default 1

  • disabled (bool, optional) – Whether the mentionable select menu is disabled, by default False

  • row (Optional[int], optional) – The row the select should be in, leave as None for auto-placement.

Returns:

The decorated function.

Return type:

Callable[[Callable[[ScreenT, ScreenMentionableSelect, ViewContextT], Awaitable[None]]], DecoratedScreenItem[ScreenT, ScreenMentionableSelect, ViewContextT]]

Raises:

TypeError – If the decorated function is not a coroutine function.

miru.ext.menu.items.role_select(*, custom_id: str | None = None, placeholder: str | None = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: int | None = None) Callable[[Callable[[ScreenT, ScreenRoleSelect, ViewContextT], Awaitable[None]]], DecoratedScreenItem[ScreenT, ScreenRoleSelect, ViewContextT]][source]#

A decorator to transform a function into a Discord UI RoleSelectMenu’s callback. This must be inside a subclass of Screen.

Parameters:
  • custom_id (Optional[str], optional) – The custom ID for the select menu, by default None

  • placeholder (Optional[str], optional) – The placeholder text to display when no roles are selected, by default None

  • min_values (int, optional) – The minimum number of roles that can be selected, by default 1

  • max_values (int, optional) – The maximum number of roles that can be selected, by default 1

  • disabled (bool, optional) – Whether the select menu is disabled or not, by default False

  • row (Optional[int], optional) – The row number to place the select menu in, by default None

Returns:

The decorated function that serves as the callback for the select menu.

Return type:

Callable[[Callable[[ScreenT, ScreenRoleSelect, ViewContextT], Awaitable[None]]], DecoratedScreenItem[ScreenT, ScreenRoleSelect, ViewContextT]]

Raises:

TypeError – If the decorated function is not a coroutine function.

miru.ext.menu.items.text_select(*, options: Sequence[SelectMenuOption | SelectOption], custom_id: str | None = None, placeholder: str | None = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: int | None = None) Callable[[Callable[[ScreenT, ScreenTextSelect, ViewContextT], Awaitable[None]]], DecoratedScreenItem[ScreenT, ScreenTextSelect, ViewContextT]][source]#

A decorator to transform a function into a Discord UI TextSelectMenu’s callback. This must be inside a subclass of Screen.

Parameters:
  • options (Sequence[Union[hikari.SelectMenuOption, miru.SelectOption]]) – The options to add to the select menu.

  • custom_id (Optional[str], optional) – The custom ID for the select menu, by default None

  • placeholder (Optional[str], optional) – The placeholder text to display when no options are selected, by default None

  • min_values (int, optional) – The minimum number of options that can be selected, by default 1

  • max_values (int, optional) – The maximum number of options that can be selected, by default 1

  • disabled (bool, optional) – Whether the select menu is disabled or not, by default False

  • row (Optional[int], optional) – The row number to place the select menu in, by default None

Returns:

The decorated function that serves as the callback for the select menu.

Return type:

Callable[[Callable[[ScreenT, ScreenTextSelect, ViewContextT], Awaitable[None]]], DecoratedScreenItem[ScreenT, ScreenTextSelect, ViewContextT]]

miru.ext.menu.items.user_select(*, custom_id: str | None = None, placeholder: str | None = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: int | None = None) Callable[[Callable[[ScreenT, ScreenUserSelect, ViewContextT], Awaitable[None]]], DecoratedScreenItem[ScreenT, ScreenUserSelect, ViewContextT]][source]#

A decorator to transform a function into a Discord UI UserSelectMenu’s callback. This must be inside a subclass of Screen.

Parameters:
  • custom_id (Optional[str], optional) – The custom ID for the select menu, by default None

  • placeholder (Optional[str], optional) – The placeholder text to display when no users are selected, by default None

  • min_values (int, optional) – The minimum number of users that can be selected, by default 1

  • max_values (int, optional) – The maximum number of users that can be selected, by default 1

  • disabled (bool, optional) – Whether the select menu is disabled or not, by default False

  • row (Optional[int], optional) – The row number to place the select menu in, by default None

Returns:

The decorated function that serves as the callback for the select menu.

Return type:

Callable[[Callable[[ScreenT, ScreenUserSelect, ViewContextT], Awaitable[None]]], DecoratedScreenItem[ScreenT, ScreenUserSelect, ViewContextT]]