Select API Reference#

class miru.select.ChannelSelect(*, 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: SelectBase

A view component representing a select menu of channels.

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

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

  • placeholder (Optional[str], optional) – Placeholder text displayed on the select menu, by default None

  • min_values (int, optional) – The minimum values a user has to select before it can be sent, by default 1

  • max_values (int, optional) – The maximum values a user can select, by default 1

  • disabled (bool, optional) – A boolean determining if the select menu should be disabled or not, by default False

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

property channel_types: Sequence[ChannelType]#

The valid channel types that can be selected from the select menu.

property type: ComponentType#

The component’s underlying component type.

property values: Sequence[InteractionChannel]#

The currently selected channels.

class miru.select.MentionableSelect(*, 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: SelectBase

A view component representing a select menu of mentionables.

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

  • placeholder (Optional[str], optional) – Placeholder text displayed on the select menu, by default None

  • min_values (int, optional) – The minimum values a user has to select before it can be sent, by default 1

  • max_values (int, optional) – The maximum values a user can select, by default 1

  • disabled (bool, optional) – A boolean determining if the select menu should be disabled or not, by default False

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

property type: ComponentType#

The component’s underlying component type.

property values: ResolvedOptionData | None#

The currently selected mentionable objects.

This is returned as a hikari.ResolvedOptionData object. You can access each type of mentionable object by using the following attributes:

  • values.users - All user objects selected

  • values.roles - All role objects selected

  • values.channels - All channel objects selected

  • values.members - All member objects selected

class miru.select.RoleSelect(*, 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: SelectBase

A view component representing a select menu of roles.

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

  • placeholder (Optional[str], optional) – Placeholder text displayed on the select menu, by default None

  • min_values (int, optional) – The minimum values a user has to select before it can be sent, by default 1

  • max_values (int, optional) – The maximum values a user can select, by default 1

  • disabled (bool, optional) – A boolean determining if the select menu should be disabled or not, by default False

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

property type: ComponentType#

The component’s underlying component type.

property values: Sequence[Role]#

The currently selected user objects.

class miru.select.SelectBase(*, 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: ViewItem, ABC

A view component representing some type of select menu. All types of selects derive from this class.

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

  • placeholder (Optional[str], optional) – Placeholder text displayed on the select menu, by default None

  • disabled (bool, optional) – A boolean determining if the select menu should be disabled or not, by default False

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

Raises:

ValueError – Exceeded the maximum of 25 select menu options possible.

property max_values: int#

The maximum amount of options a user is allowed to select.

property min_values: int#

The minimum amount of options a user has to select.

property placeholder: str | None#

The placeholder text that appears before the select menu is clicked.

class miru.select.SelectOption(label: str, value: str | None = None, description: str | None = None, emoji: str | Emoji | None = None, is_default: bool = False)[source]#

Bases: object

A more lenient way to instantiate select options.

class miru.select.TextSelect(*, 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: SelectBase

A view component representing a text select menu.

Parameters:
  • options (Sequence[Union[hikari.SelectMenuOption, SelectOption]]) – A sequence of select menu options that this select menu should use.

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

  • placeholder (Optional[str], optional) – Placeholder text displayed on the select menu, by default None

  • min_values (int, optional) – The minimum values a user has to select before it can be sent, by default 1

  • max_values (int, optional) – The maximum values a user can select, by default 1

  • disabled (bool, optional) – A boolean determining if the select menu should be disabled or not, by default False

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

Raises:

ValueError – Exceeded the maximum of 25 select menu options possible.

property options: Sequence[SelectMenuOption | SelectOption]#

The select menu’s options.

property placeholder: str | None#

The placeholder text that appears before the select menu is clicked.

property type: ComponentType#

The component’s underlying component type.

class miru.select.UserSelect(*, 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: SelectBase

A view component representing a select menu of users.

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

  • placeholder (Optional[str], optional) – Placeholder text displayed on the select menu, by default None

  • min_values (int, optional) – The minimum values a user has to select before it can be sent, by default 1

  • max_values (int, optional) – The maximum values a user can select, by default 1

  • disabled (bool, optional) – A boolean determining if the select menu should be disabled or not, by default False

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

property type: ComponentType#

The component’s underlying component type.

property values: Sequence[User]#

The currently selected user objects. Some users may also be instances of hikari.InteractionMember, depending on how they were resolved.

miru.select.channel_select(*, channel_types: t.Sequence[hikari.ChannelType] = (<ChannelType.GUILD_TEXT: 0>, ), custom_id: t.Optional[str] = None, placeholder: t.Optional[str] = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: t.Optional[int] = None) t.Callable[[t.Callable[[ViewT, ChannelSelect, ViewContextT], t.Awaitable[None]]], DecoratedItem[ViewT, ChannelSelect, ViewContextT]][source]#

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

Parameters:
  • channel_types (Sequence[Union[int, 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 of the select menu. Defaults to None.

  • placeholder (Optional[str], optional) – The placeholder to display when nothing is selected. 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 select menu is disabled. 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[[ViewT, ChannelSelect, ViewContextT], Awaitable[None]]], DecoratedItem[ViewT, ChannelSelect, ViewContextT]]

Raises:

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

miru.select.mentionable_select(*, custom_id: t.Optional[str] = None, placeholder: t.Optional[str] = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: t.Optional[int] = None) t.Callable[[t.Callable[[ViewT, MentionableSelect, ViewContextT], t.Awaitable[None]]], DecoratedItem[ViewT, MentionableSelect, ViewContextT]][source]#

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

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

  • placeholder (Optional[str], optional) – Placeholder text displayed on the select menu, by default 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 select menu is disabled. 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[[ViewT, MentionableSelect, ViewContextT], Awaitable[None]]], DecoratedItem[ViewT, MentionableSelect, ViewContextT]]

Raises:

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

miru.select.role_select(*, custom_id: t.Optional[str] = None, placeholder: t.Optional[str] = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: t.Optional[int] = None) t.Callable[[t.Callable[[ViewT, RoleSelect, ViewContextT], t.Awaitable[None]]], DecoratedItem[ViewT, RoleSelect, ViewContextT]][source]#

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

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

  • placeholder (Optional[str], optional) – Placeholder text displayed on the select menu, by default 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 select menu is disabled. 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[[ViewT, RoleSelect, ViewContextT], Awaitable[None]]], DecoratedItem[ViewT, RoleSelect, ViewContextT]]

Raises:

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

miru.select.text_select(*, options: t.Sequence[t.Union[hikari.SelectMenuOption, SelectOption]], custom_id: t.Optional[str] = None, placeholder: t.Optional[str] = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: t.Optional[int] = None) t.Callable[[t.Callable[[ViewT, TextSelect, ViewContextT], t.Awaitable[None]]], DecoratedItem[ViewT, TextSelect, ViewContextT]][source]#

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

Parameters:
  • options (Sequence[Union[hikari.SelectMenuOption, SelectOption]]) – A sequence of select menu options that this select menu should use.

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

  • placeholder (Optional[str], optional) – Placeholder text displayed on the select menu, by default 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 select menu is disabled. 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[[ViewT, TextSelect, ViewContextT], Awaitable[None]]], DecoratedItem[ViewT, TextSelect, ViewContextT]]

Raises:

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

miru.select.user_select(*, custom_id: t.Optional[str] = None, placeholder: t.Optional[str] = None, min_values: int = 1, max_values: int = 1, disabled: bool = False, row: t.Optional[int] = None) t.Callable[[t.Callable[[ViewT, UserSelect, ViewContextT], t.Awaitable[None]]], DecoratedItem[ViewT, UserSelect, ViewContextT]][source]#

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

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

  • placeholder (Optional[str], optional) – Placeholder text displayed on the select menu, by default 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 select menu is disabled. 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[[ViewT, UserSelect, ViewContextT], Awaitable[None]]], DecoratedItem[ViewT, UserSelect, ViewContextT]]

Raises:

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