Package discord4j.core.object.component
Class TextInput
java.lang.Object
discord4j.core.object.component.MessageComponent
discord4j.core.object.component.ActionComponent
discord4j.core.object.component.TextInput
A modal-only text input field
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
A text input's style is what determines its size and behaviorNested classes/interfaces inherited from class discord4j.core.object.component.MessageComponent
MessageComponent.Type
-
Method Summary
Modifier and TypeMethodDescriptionGets the text input's custom id.getLabel()
Gets the text input's labelint
Gets the text input's maximum length requirement.int
Gets the text input's minimum length requirement.Gets the text input's placeholder text, if any.getStyle()
Gets the text input's style.getValue()
Gets text input's value, if any.boolean
Gets whether the text input is required to be filled.static TextInput
Creates aparagraph
button.static TextInput
Creates aparagraph
button.static TextInput
Creates aparagraph
button.static TextInput
Creates aparagraph
button.placeholder
(String value) Creates a new text input with the same data as this, but with placeholder text.Creates a new text input with the same data as this, but with a pre-filled value.required()
Creates a new text input with the same data as this one, but required.required
(boolean value) Creates a new text input with the same data as this one, but depending on the value param it may be required or not.static TextInput
Creates ashort
button.static TextInput
Creates ashort
button.static TextInput
Creates ashort
button.static TextInput
Creates ashort
button.Methods inherited from class discord4j.core.object.component.MessageComponent
fromData, getData, getType
-
Method Details
-
small
Creates ashort
button.- Parameters:
customId
- A developer-defined identifier for the button.- Returns:
- A button with the given data.
-
small
Creates ashort
button.- Parameters:
customId
- A developer-defined identifier for the button.label
- The text that appears above the input- Returns:
- A button with the given data.
-
small
Creates ashort
button.- Parameters:
customId
- A developer-defined identifier for the button.label
- The text that appears above the inputplaceholder
- The placeholder text to be displayed- Returns:
- A button with the given data.
-
small
Creates ashort
button.- Parameters:
customId
- A developer-defined identifier for the button.label
- The text that appears above the inputminLength
- The minimum length the user is required to inputmaxLength
- The maximum length the user is required to input- Returns:
- A button with the given data.
-
paragraph
Creates aparagraph
button.- Parameters:
customId
- A developer-defined identifier for the button.- Returns:
- A button with the given data.
-
paragraph
Creates aparagraph
button.- Parameters:
customId
- A developer-defined identifier for the button.label
- The text that appears above the input- Returns:
- A button with the given data.
-
paragraph
Creates aparagraph
button.- Parameters:
customId
- A developer-defined identifier for the button.label
- The text that appears above the inputplaceholder
- The placeholder text to display- Returns:
- A button with the given data.
-
paragraph
Creates aparagraph
button.- Parameters:
customId
- A developer-defined identifier for the button.label
- The text that appears above the inputminLength
- The minimum length the user is required to inputmaxLength
- The maximum length the user is required to input- Returns:
- A button with the given data.
-
getStyle
Gets the text input's style.- Returns:
- the style of the text input
-
getCustomId
Gets the text input's custom id.- Returns:
- the custom id of the text input
-
getLabel
Gets the text input's label- Returns:
- The text input's label
-
getMinLength
public int getMinLength()Gets the text input's minimum length requirement. If not present, defaults to0
.- Returns:
- The text input's minimum length
-
getMaxLength
public int getMaxLength()Gets the text input's maximum length requirement. If not present, defaults to4000
- Returns:
- The text input's maximum length
-
isRequired
public boolean isRequired()Gets whether the text input is required to be filled. Defaults totrue
- Returns:
- Whether the text input is required
-
getValue
Gets text input's value, if any.- Returns:
- The text input's value
-
getPlaceholder
Gets the text input's placeholder text, if any.- Returns:
- The text input's placeholder
-
required
Creates a new text input with the same data as this one, but required.- Returns:
- A new required text input with the same data as this one.
-
required
Creates a new text input with the same data as this one, but depending on the value param it may be required or not.- Parameters:
value
- True if the text input should be required otherwise False.- Returns:
- A new possibly required button with the same data as this one.
-
prefilled
Creates a new text input with the same data as this, but with a pre-filled value.- Parameters:
value
- The pre-filled text value- Returns:
- A new text input with the same data as this one.
-
placeholder
Creates a new text input with the same data as this, but with placeholder text.- Parameters:
value
- The placeholder text value- Returns:
- A new text input with the same data as this one.
-