Interface MediaGallery
- All Superinterfaces:
Component
,ContainerChildComponent
,MessageTopLevelComponent
- All Known Implementing Classes:
MediaGalleryImpl
Component which displays a group of images, videos, GIFs or WEBPs into a gallery grid.
This can contain up to 10 MediaGalleryItem
.
Requirements: Components V2 needs to be enabled!
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.components.Component
Component.Type
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
How manyMediaGalleryItem
can be in a media gallery. -
Method Summary
Modifier and TypeMethodDescription@Unmodifiable List
<MediaGalleryItem> getItems()
Returns an immutable list with the items contained by this media gallery.static MediaGallery
of
(Collection<? extends MediaGalleryItem> items) Constructs a newMediaGallery
from the given items.static MediaGallery
of
(MediaGalleryItem item, MediaGalleryItem... items) Constructs a newMediaGallery
from the given items.withUniqueId
(int uniqueId) Creates a new component with the provided numeric ID.Methods inherited from interface net.dv8tion.jda.api.components.Component
getType, getUniqueId, isMessageCompatible, isModalCompatible
-
Field Details
-
MAX_ITEMS
static final int MAX_ITEMSHow manyMediaGalleryItem
can be in a media gallery. (10)- See Also:
-
-
Method Details
-
of
Constructs a newMediaGallery
from the given items.- Parameters:
items
- The items to add- Returns:
- The new
MediaGallery
- Throws:
IllegalArgumentException
-- If
null
is provided - If more than 10 items are provided
- If
-
of
Constructs a newMediaGallery
from the given items.- Parameters:
item
- The item to additems
- Additional items to add- Returns:
- The new
MediaGallery
- Throws:
IllegalArgumentException
-- If
null
is provided - If more than 10 items are provided
- If
-
withUniqueId
Description copied from interface:Component
Creates a new component with the provided numeric ID.
If no ID is set, Discord will generate IDs incrementally starting from 1 and will not use existing IDs from the same message/modal.- Specified by:
withUniqueId
in interfaceComponent
- Specified by:
withUniqueId
in interfaceContainerChildComponent
- Specified by:
withUniqueId
in interfaceMessageTopLevelComponent
- Parameters:
uniqueId
- The new ID; must be higher or equal to 1- Returns:
- The new component
-
getItems
Returns an immutable list with the items contained by this media gallery.- Returns:
List
ofMediaGalleryItem
in this media gallery
-