Select API Reference#
ChannelSelect
#
ChannelSelect(
*,
channel_types: t.Sequence[hikari.ChannelType] = (
hikari.ChannelType.GUILD_TEXT
),
custom_id: str | None = None,
placeholder: str | None = None,
min_values: int = 1,
max_values: int = 1,
disabled: bool = False,
row: int | None = None,
autodefer: (
bool | AutodeferOptions | hikari.UndefinedType
) = hikari.UNDEFINED
)
Bases: SelectBase
A view component representing a select menu of channels.
PARAMETER | DESCRIPTION |
---|---|
channel_types |
A sequence of channel types to filter the select menu by
TYPE:
|
custom_id |
The custom identifier of the select menu
TYPE:
|
placeholder |
Placeholder text displayed on the select menu
TYPE:
|
min_values |
The minimum values a user has to select before it can be sent
TYPE:
|
max_values |
The maximum values a user can select
TYPE:
|
disabled |
A boolean determining if the select menu should be disabled or not
TYPE:
|
row |
The row the select menu should be in, leave as None for auto-placement.
TYPE:
|
autodefer |
The autodefer options for the select menu. If left
TYPE:
|
row
property
writable
#
row: int | None
The row the item should occupy. Leave as None for automatic placement.
position
property
writable
#
position: int | None
The position of the item within the row it occupies.
custom_id
property
writable
#
custom_id: str
The item's custom identifier. This will be used to track the item through interactions and is required for persistent views.
autodefer
property
#
autodefer: AutodeferOptions | hikari.UndefinedType
Indicates whether the item should be deferred automatically.
If left as UNDEFINED
, the view's autodefer option will be used.
placeholder
property
writable
#
placeholder: str | None
The placeholder text that appears before the select menu is clicked.
max_values
property
writable
#
max_values: int
The maximum amount of options a user is allowed to select.
channel_types
property
writable
#
channel_types: t.Sequence[hikari.ChannelType]
The valid channel types that can be selected from the select menu.
callback
async
#
callback(context: ViewContext) -> None
The component's callback, gets called when the component receives an interaction.
PARAMETER | DESCRIPTION |
---|---|
context |
The context, proxying the incoming interaction.
TYPE:
|
MentionableSelect
#
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,
autodefer: (
bool | AutodeferOptions | hikari.UndefinedType
) = hikari.UNDEFINED
)
Bases: SelectBase
A view component representing a select menu of mentionables.
PARAMETER | DESCRIPTION |
---|---|
custom_id |
The custom identifier of the select menu
TYPE:
|
placeholder |
Placeholder text displayed on the select menu
TYPE:
|
min_values |
The minimum values a user has to select before it can be sent
TYPE:
|
max_values |
The maximum values a user can select
TYPE:
|
disabled |
A boolean determining if the select menu should be disabled or not
TYPE:
|
row |
The row the select menu should be in, leave as None for auto-placement.
TYPE:
|
autodefer |
The autodefer options for the select menu. If left
TYPE:
|
row
property
writable
#
row: int | None
The row the item should occupy. Leave as None for automatic placement.
position
property
writable
#
position: int | None
The position of the item within the row it occupies.
custom_id
property
writable
#
custom_id: str
The item's custom identifier. This will be used to track the item through interactions and is required for persistent views.
autodefer
property
#
autodefer: AutodeferOptions | hikari.UndefinedType
Indicates whether the item should be deferred automatically.
If left as UNDEFINED
, the view's autodefer option will be used.
placeholder
property
writable
#
placeholder: str | None
The placeholder text that appears before the select menu is clicked.
max_values
property
writable
#
max_values: int
The maximum amount of options a user is allowed to select.
values
property
#
values: hikari.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 selectedvalues.roles
- All role objects selectedvalues.channels
- All channel objects selectedvalues.members
- All member objects selected
callback
async
#
callback(context: ViewContext) -> None
The component's callback, gets called when the component receives an interaction.
PARAMETER | DESCRIPTION |
---|---|
context |
The context, proxying the incoming interaction.
TYPE:
|
RoleSelect
#
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,
autodefer: (
bool | AutodeferOptions | hikari.UndefinedType
) = hikari.UNDEFINED
)
Bases: SelectBase
A view component representing a select menu of roles.
PARAMETER | DESCRIPTION |
---|---|
custom_id |
The custom identifier of the select menu
TYPE:
|
placeholder |
Placeholder text displayed on the select menu
TYPE:
|
min_values |
The minimum values a user has to select before it can be sent
TYPE:
|
max_values |
The maximum values a user can select
TYPE:
|
disabled |
A boolean determining if the select menu should be disabled or not
TYPE:
|
row |
The row the select menu should be in, leave as None for auto-placement.
TYPE:
|
autodefer |
The autodefer options for the select menu. If left
TYPE:
|
row
property
writable
#
row: int | None
The row the item should occupy. Leave as None for automatic placement.
position
property
writable
#
position: int | None
The position of the item within the row it occupies.
custom_id
property
writable
#
custom_id: str
The item's custom identifier. This will be used to track the item through interactions and is required for persistent views.
autodefer
property
#
autodefer: AutodeferOptions | hikari.UndefinedType
Indicates whether the item should be deferred automatically.
If left as UNDEFINED
, the view's autodefer option will be used.
placeholder
property
writable
#
placeholder: str | None
The placeholder text that appears before the select menu is clicked.
max_values
property
writable
#
max_values: int
The maximum amount of options a user is allowed to select.
callback
async
#
callback(context: ViewContext) -> None
The component's callback, gets called when the component receives an interaction.
PARAMETER | DESCRIPTION |
---|---|
context |
The context, proxying the incoming interaction.
TYPE:
|
SelectOption
#
SelectOption(
label: str,
value: str | None = None,
description: str | None = None,
emoji: str | hikari.Emoji | None = None,
is_default: bool = False,
)
A more lenient way to instantiate select options.
A more lenient way to instantiate select options.
PARAMETER | DESCRIPTION |
---|---|
label |
The option's label.
TYPE:
|
value |
The internal value of the option, if None, uses label.
TYPE:
|
description |
The description of the option
TYPE:
|
emoji |
The emoji of the option |
is_default |
A boolean determining of the option is default or not
TYPE:
|
TextSelect
#
TextSelect(
*,
options: t.Sequence[
hikari.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,
autodefer: (
bool | AutodeferOptions | hikari.UndefinedType
) = hikari.UNDEFINED
)
Bases: SelectBase
A view component representing a text select menu.
PARAMETER | DESCRIPTION |
---|---|
options |
A sequence of select menu options that this select menu should use.
TYPE:
|
custom_id |
The custom identifier of the select menu
TYPE:
|
placeholder |
Placeholder text displayed on the select menu
TYPE:
|
min_values |
The minimum values a user has to select before it can be sent
TYPE:
|
max_values |
The maximum values a user can select
TYPE:
|
disabled |
A boolean determining if the select menu should be disabled or not
TYPE:
|
row |
The row the select menu should be in, leave as None for auto-placement.
TYPE:
|
autodefer |
The autodefer options for the select menu. If left
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
Exceeded the maximum of 25 select menu options possible. |
row
property
writable
#
row: int | None
The row the item should occupy. Leave as None for automatic placement.
position
property
writable
#
position: int | None
The position of the item within the row it occupies.
custom_id
property
writable
#
custom_id: str
The item's custom identifier. This will be used to track the item through interactions and is required for persistent views.
autodefer
property
#
autodefer: AutodeferOptions | hikari.UndefinedType
Indicates whether the item should be deferred automatically.
If left as UNDEFINED
, the view's autodefer option will be used.
max_values
property
writable
#
max_values: int
The maximum amount of options a user is allowed to select.
options
property
writable
#
options: t.Sequence[hikari.SelectMenuOption | SelectOption]
The select menu's options.
placeholder
property
writable
#
placeholder: str | None
The placeholder text that appears before the select menu is clicked.
callback
async
#
callback(context: ViewContext) -> None
The component's callback, gets called when the component receives an interaction.
PARAMETER | DESCRIPTION |
---|---|
context |
The context, proxying the incoming interaction.
TYPE:
|
UserSelect
#
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,
autodefer: (
bool | AutodeferOptions | hikari.UndefinedType
) = hikari.UNDEFINED
)
Bases: SelectBase
A view component representing a select menu of users.
PARAMETER | DESCRIPTION |
---|---|
custom_id |
The custom identifier of the select menu
TYPE:
|
placeholder |
Placeholder text displayed on the select menu
TYPE:
|
min_values |
The minimum values a user has to select before it can be sent
TYPE:
|
max_values |
The maximum values a user can select
TYPE:
|
disabled |
A boolean determining if the select menu should be disabled or not
TYPE:
|
row |
The row the select menu should be in, leave as None for auto-placement.
TYPE:
|
autodefer |
The autodefer options for the select menu. If left
TYPE:
|
row
property
writable
#
row: int | None
The row the item should occupy. Leave as None for automatic placement.
position
property
writable
#
position: int | None
The position of the item within the row it occupies.
custom_id
property
writable
#
custom_id: str
The item's custom identifier. This will be used to track the item through interactions and is required for persistent views.
autodefer
property
#
autodefer: AutodeferOptions | hikari.UndefinedType
Indicates whether the item should be deferred automatically.
If left as UNDEFINED
, the view's autodefer option will be used.
placeholder
property
writable
#
placeholder: str | None
The placeholder text that appears before the select menu is clicked.
max_values
property
writable
#
max_values: int
The maximum amount of options a user is allowed to select.
values
property
#
The currently selected user objects.
Some users may also be instances of hikari.InteractionMember
, depending on how they were resolved.
callback
async
#
callback(context: ViewContext) -> None
The component's callback, gets called when the component receives an interaction.
PARAMETER | DESCRIPTION |
---|---|
context |
The context, proxying the incoming interaction.
TYPE:
|
channel_select
#
channel_select(
*,
channel_types: t.Sequence[hikari.ChannelType] = (
hikari.ChannelType.GUILD_TEXT
),
custom_id: str | None = None,
placeholder: str | None = None,
min_values: int = 1,
max_values: int = 1,
disabled: bool = False,
row: int | None = None,
autodefer: (
bool | AutodeferOptions | hikari.UndefinedType
) = hikari.UNDEFINED
) -> t.Callable[
[
t.Callable[
[ViewT, ViewContext, ChannelSelect],
t.Awaitable[None],
]
],
DecoratedItem[ViewT, ChannelSelect],
]
A decorator to transform a function into a Discord UI ChannelSelectMenu's callback. This must be inside a subclass of View.
PARAMETER | DESCRIPTION |
---|---|
channel_types |
A sequence of channel types to filter the select menu by.
TYPE:
|
custom_id |
The custom ID of the select menu
TYPE:
|
placeholder |
The placeholder to display when nothing is selected
TYPE:
|
min_values |
The minimum number of values that can be selected
TYPE:
|
max_values |
The maximum number of values that can be selected
TYPE:
|
disabled |
Whether the select menu is disabled
TYPE:
|
row |
The row the select should be in, leave as None for auto-placement.
TYPE:
|
autodefer |
The autodefer options for the select menu. If left
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
t.Callable[[Callable[[ViewT, ViewContext, ChannelSelect], Awaitable[None]]], DecoratedItem[ViewT, ChannelSelect]]
|
The decorated function. |
RAISES | DESCRIPTION |
---|---|
TypeError
|
If the decorated function is not a coroutine function. |
mentionable_select
#
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,
autodefer: (
bool | AutodeferOptions | hikari.UndefinedType
) = hikari.UNDEFINED
) -> t.Callable[
[
t.Callable[
[ViewT, ViewContext, MentionableSelect],
t.Awaitable[None],
]
],
DecoratedItem[ViewT, MentionableSelect],
]
A decorator to transform a function into a Discord UI MentionableSelectMenu's callback. This must be inside a subclass of View.
PARAMETER | DESCRIPTION |
---|---|
custom_id |
The custom ID of the select menu
TYPE:
|
placeholder |
Placeholder text displayed on the select menu
TYPE:
|
min_values |
The minimum number of values that can be selected.
TYPE:
|
max_values |
The maximum number of values that can be selected.
TYPE:
|
disabled |
Whether the select menu is disabled.
TYPE:
|
row |
The row the select should be in, leave as None for auto-placement.
TYPE:
|
autodefer |
The autodefer options for the select menu. If left
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Callable[[Callable[[ViewT, ViewContext, MentionableSelect], Awaitable[None]]], DecoratedItem[ViewT, MentionableSelect]]
|
The decorated function. |
RAISES | DESCRIPTION |
---|---|
TypeError
|
If the decorated function is not a coroutine function. |
role_select
#
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,
autodefer: (
bool | AutodeferOptions | hikari.UndefinedType
) = hikari.UNDEFINED
) -> t.Callable[
[
t.Callable[
[ViewT, ViewContext, RoleSelect],
t.Awaitable[None],
]
],
DecoratedItem[ViewT, RoleSelect],
]
A decorator to transform a function into a Discord UI RoleSelectMenu's callback. This must be inside a subclass of View.
PARAMETER | DESCRIPTION |
---|---|
custom_id |
The custom ID of the select menu
TYPE:
|
placeholder |
Placeholder text displayed on the select menu
TYPE:
|
min_values |
The minimum number of values that can be selected.
TYPE:
|
max_values |
The maximum number of values that can be selected.
TYPE:
|
disabled |
Whether the select menu is disabled. Defaults to False.
TYPE:
|
row |
The row the select should be in, leave as None for auto-placement.
TYPE:
|
autodefer |
The autodefer options for the select menu. If left
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Callable[[Callable[[ViewT, ViewContext, RoleSelect], Awaitable[None]]], DecoratedItem[ViewT, RoleSelect]]
|
The decorated function. |
RAISES | DESCRIPTION |
---|---|
TypeError
|
If the decorated function is not a coroutine function. |
text_select
#
text_select(
*,
options: t.Sequence[
hikari.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,
autodefer: (
bool | AutodeferOptions | hikari.UndefinedType
) = hikari.UNDEFINED
) -> t.Callable[
[
t.Callable[
[ViewT, ViewContext, TextSelect],
t.Awaitable[None],
]
],
DecoratedItem[ViewT, TextSelect],
]
A decorator to transform a function into a Discord UI TextSelectMenu's callback. This must be inside a subclass of View.
PARAMETER | DESCRIPTION |
---|---|
options |
A sequence of select menu options that this select menu should use.
TYPE:
|
custom_id |
The custom ID of the select menu.
TYPE:
|
placeholder |
Placeholder text displayed on the select menu.
TYPE:
|
min_values |
The minimum number of values that can be selected.
TYPE:
|
max_values |
The maximum number of values that can be selected.
TYPE:
|
disabled |
Whether the select menu is disabled.
TYPE:
|
row |
The row the select should be in, leave as None for auto-placement.
TYPE:
|
autodefer |
The autodefer options for the select menu. If left
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Callable[[Callable[[ViewT, ViewContext, TextSelect], Awaitable[None]]], DecoratedItem[ViewT, TextSelect]]
|
The decorated function. |
RAISES | DESCRIPTION |
---|---|
TypeError
|
If the decorated function is not a coroutine function. |
user_select
#
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,
autodefer: (
bool | AutodeferOptions | hikari.UndefinedType
) = hikari.UNDEFINED
) -> t.Callable[
[
t.Callable[
[ViewT, ViewContext, UserSelect],
t.Awaitable[None],
]
],
DecoratedItem[ViewT, UserSelect],
]
A decorator to transform a function into a Discord UI UserSelectMenu's callback. This must be inside a subclass of View.
PARAMETER | DESCRIPTION |
---|---|
custom_id |
The custom ID of the select menu
TYPE:
|
placeholder |
Placeholder text displayed on the select menu
TYPE:
|
min_values |
The minimum number of values that can be selected.
TYPE:
|
max_values |
The maximum number of values that can be selected.
TYPE:
|
disabled |
Whether the select menu is disabled.
TYPE:
|
row |
The row the select should be in, leave as None for auto-placement.
TYPE:
|
autodefer |
The autodefer options for the select menu. If left
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Callable[[Callable[[ViewT, ViewContext, UserSelect], Awaitable[None]]], DecoratedItem[ViewT, UserSelect]]
|
The decorated function. |
RAISES | DESCRIPTION |
---|---|
TypeError
|
If the decorated function is not a coroutine function. |