wtf
This commit is contained in:
@@ -5,16 +5,39 @@ const { MessageComponentTypes } = require('../util/Constants');
|
||||
|
||||
class ContainerComponent extends BaseMessageComponent {
|
||||
/**
|
||||
*
|
||||
* @param {*} data
|
||||
* @typedef {MessageActionRow|TextDisplayComponent|SectionComponent|MediaGalleryComponent|SeparatorComponent|FileComponent} ContainerComponents
|
||||
* @property {ContainerComponents[]} [components] Components of the type action row, text display, section, media gallery, separator, or file
|
||||
* @property {Number} [accent_color] Color for the accent on the container as RGB from 0x000000 to 0xFFFFFF
|
||||
* @property {Boolean} [spoiler] Whether the container should be a spoiler (or blurred out). Defaults to false.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {} [data={}]
|
||||
*/
|
||||
constructor(data = {}) {
|
||||
super({ type: 'CONTAINER' }, data);
|
||||
/**
|
||||
* Components of the type action row, text display, section, media gallery, separator, or file
|
||||
* @type {ContainerComponents[]}
|
||||
*/
|
||||
this.components = data.components?.map(c => BaseMessageComponent.create(c)) ?? null;
|
||||
|
||||
/**
|
||||
* Color for the accent on the container as RGB from 0x000000 to 0xFFFFFF
|
||||
* @type {Number}
|
||||
*/
|
||||
this.accent_color = data.accent_color ?? null;
|
||||
|
||||
/**
|
||||
* Whether the container should be a spoiler (or blurred out). Defaults to false.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
this.spoiler = data.spoiler ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {APIContainerComponent}
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
type: MessageComponentTypes[this.type],
|
||||
|
||||
Reference in New Issue
Block a user