mirror of
https://github.com/discordjs/discord.js.git
synced 2026-06-01 08:30:08 +00:00
* feat: bump builders in v14 (and fix runtime crashes) * chore: bump dtypes * Update packages/discord.js/src/structures/LabelBuilder.js Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> * chore: requested changes * chore: lint --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
55 lines
956 B
JavaScript
55 lines
956 B
JavaScript
'use strict';
|
|
|
|
const Component = require('./Component');
|
|
const { createComponent } = require('../util/Components');
|
|
|
|
/**
|
|
* Represents a label component
|
|
*
|
|
* @extends {Component}
|
|
*/
|
|
class LabelComponent extends Component {
|
|
constructor({ component, ...data }) {
|
|
super(data);
|
|
|
|
/**
|
|
* The component in this label
|
|
*
|
|
* @type {Component}
|
|
* @readonly
|
|
*/
|
|
this.component = createComponent(component);
|
|
}
|
|
|
|
/**
|
|
* The label of the component
|
|
*
|
|
* @type {string}
|
|
* @readonly
|
|
*/
|
|
get label() {
|
|
return this.data.label;
|
|
}
|
|
|
|
/**
|
|
* The description of this component
|
|
*
|
|
* @type {?string}
|
|
* @readonly
|
|
*/
|
|
get description() {
|
|
return this.data.description ?? null;
|
|
}
|
|
|
|
/**
|
|
* Returns the API-compatible JSON for this component
|
|
*
|
|
* @returns {APILabelComponent}
|
|
*/
|
|
toJSON() {
|
|
return { ...this.data, component: this.component.toJSON() };
|
|
}
|
|
}
|
|
|
|
module.exports = LabelComponent;
|