Files
discord.js-selfbot/src/structures/ContainerComponent.js

28 lines
767 B
JavaScript
Raw Normal View History

2025-06-23 22:04:53 +07:00
'use strict';
const BaseMessageComponent = require('./BaseMessageComponent');
const { MessageComponentTypes } = require('../util/Constants');
class ContainerComponent extends BaseMessageComponent {
2025-06-29 11:01:41 +07:00
/**
*
* @param {*} data
*/
2025-06-23 22:04:53 +07:00
constructor(data = {}) {
2025-06-24 12:32:58 +07:00
super({ type: 'CONTAINER' }, data);
2025-06-23 22:04:53 +07:00
this.components = data.components?.map(c => BaseMessageComponent.create(c)) ?? null;
this.accent_color = data.accent_color ?? null;
this.spoiler = data.spoiler ?? false;
}
toJSON() {
return {
type: MessageComponentTypes[this.type],
components: this.components.map(c => c.toJSON()),
accent_color: this.accent_color,
spoiler: this.spoiler,
};
}
}
module.exports = ContainerComponent;