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

24 lines
717 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 {
constructor(data = {}) {
super({ type: 'CONTAINER' });
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;