Interface MediaGallery
- All Superinterfaces:
Component,ContainerChildComponent,MessageTopLevelComponent
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 intHow manyMediaGalleryItemcan 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 MediaGalleryof(Collection<? extends MediaGalleryItem> items) Constructs a newMediaGalleryfrom the given items.static MediaGalleryof(MediaGalleryItem item, MediaGalleryItem... items) Constructs a newMediaGalleryfrom the given items.withItems(Collection<? extends MediaGalleryItem> items) Creates a newMediaGallerywith the specified items.default MediaGallerywithItems(MediaGalleryItem item, MediaGalleryItem... items) Creates a newMediaGallerywith the specified 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 manyMediaGalleryItemcan be in a media gallery. (10)- See Also:
-
-
Method Details
-
of
Constructs a newMediaGalleryfrom the given items.- Parameters:
items- The items to add- Returns:
- The new
MediaGallery - Throws:
IllegalArgumentException-- If
nullis provided - If more than 10 items are provided
- If
-
of
Constructs a newMediaGalleryfrom the given items.- Parameters:
item- The item to additems- Additional items to add- Returns:
- The new
MediaGallery - Throws:
IllegalArgumentException-- If
nullis provided - If more than 10 items are provided
- If
-
withUniqueId
Description copied from interface:ComponentCreates 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:
withUniqueIdin interfaceComponent- Specified by:
withUniqueIdin interfaceContainerChildComponent- Specified by:
withUniqueIdin interfaceMessageTopLevelComponent- Parameters:
uniqueId- The new ID; must be higher or equal to 1- Returns:
- The new component
-
withItems
@Nonnull @CheckReturnValue MediaGallery withItems(@Nonnull Collection<? extends MediaGalleryItem> items) Creates a newMediaGallerywith the specified items.- Parameters:
items- The new items- Returns:
- The new
MediaGallery - Throws:
IllegalArgumentException- If the provided items arenullor containsnull
-
withItems
@Nonnull @CheckReturnValue default MediaGallery withItems(@Nonnull MediaGalleryItem item, @Nonnull MediaGalleryItem... items) Creates a newMediaGallerywith the specified items.- Parameters:
item- The first new itemsitems- Additional new items- Returns:
- The new
MediaGallery - Throws:
IllegalArgumentException- If the provided items arenullor containsnull
-
getItems
Returns an immutable list with the items contained by this media gallery.- Returns:
ListofMediaGalleryItemin this media gallery
-