Class Modal.Builder
java.lang.Object
net.dv8tion.jda.api.interactions.modals.Modal.Builder
- Enclosing interface:
Modal
A preconfigured builder for the creation of modals.
-
Method Summary
Modifier and TypeMethodDescriptionaddActionRow
(Collection<? extends ItemComponent> components) Adds an ActionRow to this modaladdActionRow
(ItemComponent... components) Adds an ActionRow to this modaladdComponents
(Collection<? extends LayoutComponent> components) AddsLayoutComponents
to this modaladdComponents
(LayoutComponent... components) AddsLayoutComponents
to this modalbuild()
Builds and returns theModal
Returns a modifiable list of all componentsgetId()
Returns the custom idgetTitle()
Returns the titleSets the custom id for this modal.Sets the title for this modal.
-
Method Details
-
setId
Sets the custom id for this modal.- Parameters:
customId
- Custom id- Returns:
- The same builder instance for chaining
- Throws:
IllegalArgumentException
- If the provided id is null, blank, or is longer than 100 characters.
-
setTitle
Sets the title for this modal.- Parameters:
title
- The title- Returns:
- The same builder instance for chaining
- Throws:
IllegalArgumentException
- If the provided title is null, blank or longer than 45 characters
-
addComponents
AddsLayoutComponents
to this modal- Parameters:
components
-LayoutComponents
to add to the modal, up to 5 total- Returns:
- The same builder instance for chaining
- Throws:
IllegalArgumentException
-- If any of the provided layouts are null
- If any of the provided components are not compatible with Modals
- See Also:
-
addComponents
@Nonnull public Modal.Builder addComponents(@Nonnull Collection<? extends LayoutComponent> components) AddsLayoutComponents
to this modal- Parameters:
components
-LayoutComponents
to add to the modal, up to 5 total- Returns:
- The same builder instance for chaining
- Throws:
IllegalArgumentException
-- If any of the provided layouts are null
- If any of the provided components are not compatible with Modals
- See Also:
-
addActionRow
Adds an ActionRow to this modal- Parameters:
components
- The components to add- Returns:
- Same builder for chaining convenience
- Throws:
IllegalArgumentException
-- If any of the provided ItemComponents are null, or an invalid number of components are provided
- If any of the provided ItemComponents are not compatible with Modals
- See Also:
-
addActionRow
Adds an ActionRow to this modal- Parameters:
components
- The components to add- Returns:
- Same builder for chaining convenience
- Throws:
IllegalArgumentException
-- If any of the provided ItemComponents are null, or an invalid number of components are provided
- If any of the provided ItemComponents are not compatible with Modals
- See Also:
-
getComponents
Returns a modifiable list of all components- Returns:
- A modifiable list of all components
-
getTitle
Returns the title- Returns:
- the title
-
getId
Returns the custom id- Returns:
- the id
-
build
Builds and returns theModal
- Returns:
- A Modal
- Throws:
IllegalArgumentException
-- If no components are added
- If more than 5 component layouts are added
-