View Source Nostrum.Struct.Message.Component (Nostrum v0.6.0)
A component attached to a message.
Note that the fields present depend on the type/0
of the component object.
See the Discord API Component Object Documentation for more information.
Link to this section Summary
Types
Child components for action rows.
A developer-defined identifier for the component.
Whether the component is disabled.
Partial emoji of the button.
Text that appears on the button, or above the text input.
Maximum length of the input text.
Maximum number of items that must be chosen.
Minimum length of the input text.
Minimum number of items that must be chosen.
Choices of the select menu.
Custom placeholder text if nothing is selected.
Whether the component is required to be filled, defaults to false
.
An integer representing the style of the button or text input.
Represents a message component.
Component type.
URL for link-style buttons.
The current value of the component.
Link to this section Types
Specs
components() :: [t()]
Child components for action rows.
Only present for action rows.
Specs
custom_id() :: String.t() | nil
A developer-defined identifier for the component.
Maximum of 100 characters. Only present for buttons and select menus.
Specs
disabled() :: boolean() | nil
Whether the component is disabled.
Only present for buttons and select menus.
Specs
emoji() :: Nostrum.Struct.Emoji.t() | nil
Partial emoji of the button.
Only present for buttons. The following fields are set:
name
id
animated
Specs
label() :: String.t() | nil
Text that appears on the button, or above the text input.
Maximum of 80 characters. Only present for buttons and text input.
Specs
max_length() :: 1..4000 | nil
Maximum length of the input text.
Defaults to 1
. Maximum of 4000
. Only present for text inputs.
Specs
max_values() :: 1..25 | nil
Maximum number of items that must be chosen.
Defaults to 1
. Maximum of 25
. Only present for select menus.
Specs
min_length() :: 0..4000 | nil
Minimum length of the input text.
Defaults to 0
. Maximum of 4000
. Only present for text inputs.
Specs
min_values() :: 0..25 | nil
Minimum number of items that must be chosen.
Defaults to 1
. Minimum of 0
. Maximum of 25
. Only present for select menus.
Specs
options() :: [ %{ :label => String.t(), :value => String.t(), optional(:description) => String.t(), optional(:emoji) => %{ id: Nostrum.Struct.Emoji.id(), name: Nostrum.Struct.Emoji.name(), animated: Nostrum.Struct.Emoji.animated() }, optional(:default) => boolean() } ] | nil
Choices of the select menu.
Maximum of 25 options. Only present for select menus.
References
Specs
placeholder() :: String.t() | nil
Custom placeholder text if nothing is selected.
Maximum of 100 characters. Only present for select menus and text inputs.
Specs
required() :: boolean() | nil
Whether the component is required to be filled, defaults to false
.
Only present for text inputs.
Specs
style() :: 1 | 2 | 3 | 4 | 5 | nil
An integer representing the style of the button or text input.
Only present for buttons and text input.
Values (Button)
1
: Primary - blurple,custom_id
required.2
: Secondary - grey,custom_id
required.3
: Success - green,custom_id
required.4
: Danger - red,custom_id
required.5
: Link - grey,url
required, navigates to the URL.
Values (Text Input)
1
: Short - A single line text input.2
: Paragraph - A multi-line text input.
References
Specs
t() :: %Nostrum.Struct.Message.Component{ components: components(), custom_id: custom_id(), disabled: disabled(), emoji: emoji(), label: label(), max_length: max_length(), max_values: max_values(), min_length: min_length(), min_values: min_values(), options: options(), placeholder: placeholder(), required: required(), style: style(), type: type(), url: url(), value: value() }
Represents a message component.
Specs
type() :: 1 | 2 | 3 | 4
Component type.
This field is always set.
Values
1
: Action Row - A container for other components.2
: Button - A button object.3
: Select Menu - A select menu for picking from choices.4
: Text Input - A text input field.
References
Specs
url() :: String.t() | nil
URL for link-style buttons.
Only present for buttons.
Specs
value() :: String.t() | nil
The current value of the component.
When creating a new component, this will be its pre-filled value if present. Only present for text inputs.