class MediaGalleryBuilder

external
declare class MediaGalleryBuilder extends ComponentBuilder<APIMediaGalleryComponent>

A builder that creates API-compatible JSON data for a container.

Constructors

constructor()

Creates a new media gallery from API data.

Examples:Creating a media gallery from an API data object:
const mediaGallery = new MediaGalleryBuilder({
	items: [
		{
			description: "Some text here",
			media: {
				url: 'https://cdn.discordapp.com/embed/avatars/2.png',
			},
		},
	],
});
Creating a media gallery using setters and API data:
const mediaGallery = new MediaGalleryBuilder({
	items: [
		{
			description: "alt text",
			media: {
				url: 'https://cdn.discordapp.com/embed/avatars/5.png',
			},
		},
	],
})
	.addItems(item2, item3);

readonlyexternal
data : Partial<APIMediaGalleryComponent>

The API data associated with this component.

Inherited from: ComponentBuilder

readonlyexternal
items : MediaGalleryItemBuilder[]

The components within this container.

Adds items to this media gallery.

external
clearId() : this

Clears the id of this component, defaulting to a default incremented id.

Inherited from: ComponentBuilder

external
setId(
id: number
) : this

Sets the id (not the custom id) for this component.

Inherited from: ComponentBuilder

external
spliceItems() : this

Removes, replaces, or inserts media gallery items for this media gallery.

external
toJSON() : APIMediaGalleryComponent

Serializes this builder to API-compatible JSON data.