Component Models#
- class interactions.client.models.component.SelectOption(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing the select option of a select menu. The structure for a select option:
interactions.SelectOption( label="I'm a cool option. :)", value="internal_option_value", description="some extra info about me! :D", )
- Variables:
label (str) – The label of the select option.
value (str) – The returned value of the select option.
description (Optional[str]) – The description of the select option.
emoji (Optional[Emoji]) – The emoji used alongside the label of the select option.
default (Optional[bool]) – Whether the select option is the default for the select menu.
- class interactions.client.models.component.SelectMenu(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing the select menu of a component. The structure for a select menu:
interactions.SelectMenu( options=[interactions.SelectOption(...)], placeholder="Check out my options. :)", custom_id="menu_component", )
- Variables:
type (ComponentType) – The type of select menu. If not given, it defaults to
ComponentType.SELECT
(STRING_SELECT
)custom_id (str) – The customized “ID” of the select menu.
options (Optional[List[SelectOption]]) – The list of select options in the select menu. This only applies to String-based selects.
placeholder (Optional[str]) – The placeholder of the select menu.
min_values (Optional[int]) – The minimum “options”/values to choose from the component.
max_values (Optional[int]) – The maximum “options”/values to choose from the component.
disabled (Optional[bool]) – Whether the select menu is unable to be used.
channel_types (Optional[List[int]]) – Optional channel types to filter/whitelist. Only works with the CHANNEL_SELECT type.
- class interactions.client.models.component.Button(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing the button of a component. The structure for a button:
interactions.Button( style=interactions.ButtonStyle.DANGER, label="Delete", custom_id="delete_message", )
- Variables:
type (ComponentType) – The type of button. Always defaults to
2
.style (ButtonStyle) – The style of the button.
label (str) – The label of the button.
emoji (Optional[Emoji]) – The emoji used alongside the label of the button.
custom_id (Optional[str]) – The customized “ID” of the button.
url (Optional[str]) – The URL route/path of the button.
disabled (Optional[bool]) – Whether the button is unable to be used.
- class interactions.client.models.component.Component(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing the component in an interaction response/followup.
Note
components
is only applicable if an ActionRow is supported, otherwise ActionRow-less will be opted.list
is in reference to the class.Warning
This object class is only inferred upon when the gateway is processing back information involving a component. Do not use this object for sending.
- Variables:
type (ComponentType) – The type of component.
custom_id (Optional[str]) – The customized “ID” of the component.
disabled (Optional[bool]) – Whether the component is unable to be used.
style (Optional[ButtonStyle]) – The style of the component.
label (Optional[str]) – The label of the component.
emoji (Optional[Emoji]) – The emoji used alongside the label of the component.
url (Optional[str]) – The URl route/path of the component.
options (Optional[List[SelectMenu]]) – The “choices”/options of the component.
placeholder (Optional[str]) – The placeholder text/value of the component.
min_values (Optional[int]) – The minimum “options”/values to choose from the component.
max_values (Optional[int]) – The maximum “options”/values to choose from the component.
components (Optional[List[Component]]) – A list of components nested in the component.
min_length (Optional[int]) – The minimum input length to choose from the component.
max_length (Optional[int]) – The maximum input length to choose from the component.
required (Optional[bool]) – Whether this component is required to be filled.
value (Optional[str]) – The pre-filled value of the component.
- class interactions.client.models.component.TextInput(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing the text input of a modal. The structure for a text input:
interactions.TextInput( style=interactions.TextStyleType.SHORT, label="Let's get straight to it: what's 1 + 1?", custom_id="text_input_response", min_length=2, max_length=3, )
- Variables:
type (ComponentType) – The type of input. Always defaults to
4
.style (TextStyleType) – The style of the input.
custom_id (str) – The custom Id of the input.
label (str) – The label of the input.
value (Optional[str]) – The pre-filled value of the input.
required (Optional[bool]) – Whether the input is required or not.
placeholder (Optional[str]) – The placeholder of the input.
min_length (Optional[int]) – The minimum length of the input.
max_length (Optional[int]) – The maximum length of the input.
- class interactions.client.models.component.Modal(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing a modal. The structure for a modal:
interactions.Modal( title="Application Form", custom_id="mod_app_form", components=[interactions.TextInput(...)], )
- class interactions.client.models.component.ActionRow(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing the action row for interaction responses holding components.
Note
A message cannot have more than 5 ActionRow’s supported. An ActionRow may also support only 1 text input component only.
The structure for an action row:
# "..." represents a component object. # Method 1: interactions.ActionRow(...) # Method 2: interactions.ActionRow(components=[...])
- Variables: