mirror of
https://github.com/discordjs/discord.js.git
synced 2026-06-02 00:50:09 +00:00
Co-authored-by: Naiyar <137700126+imnaiyar@users.noreply.github.com> Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: Vlad Frangu <me@vladfrangu.dev> Co-authored-by: Timo <mail@geniustimo.de>
32 lines
707 B
JavaScript
32 lines
707 B
JavaScript
'use strict';
|
|
|
|
const Component = require('./Component');
|
|
const MediaGalleryItem = require('./MediaGalleryItem');
|
|
|
|
/**
|
|
* Represents a media gallery component
|
|
* @extends {Component}
|
|
*/
|
|
class MediaGalleryComponent extends Component {
|
|
constructor({ items, ...data }) {
|
|
super(data);
|
|
|
|
/**
|
|
* The items in this media gallery
|
|
* @type {MediaGalleryItem[]}
|
|
* @readonly
|
|
*/
|
|
this.items = items.map(item => new MediaGalleryItem(item));
|
|
}
|
|
|
|
/**
|
|
* Returns the API-compatible JSON for this component
|
|
* @returns {APIMediaGalleryComponent}
|
|
*/
|
|
toJSON() {
|
|
return { ...this.data, items: this.items.map(item => item.toJSON()) };
|
|
}
|
|
}
|
|
|
|
module.exports = MediaGalleryComponent;
|