v2componentsbuilder
Version:
A discord.js v2components builder
24 lines (23 loc) • 609 B
JavaScript
import { ComponentType } from 'discord-api-types/v10';
export class V2MediaGalleryBuilder {
constructor() {
this.type = ComponentType.MediaGallery;
}
setId(id) {
this.id = id;
return this;
}
setItems(items) {
if (items.length > 10 || items.length < 1)
throw new Error('Media Galleries must contain 1-10 media attachments');
this.items = items;
return this;
}
toJSON() {
return {
id: this.id ?? undefined,
type: ComponentType.MediaGallery,
items: this.items,
};
}
}