LabelBuilder

export declare class LabelBuilder extends ComponentBuilder<LabelBuilderData>
export declare class LabelBuilder extends ComponentBuilder<LabelBuilderData>
A builder that creates API-compatible JSON data for labels.
constructor(data?)
Creates a new label.
Example
Creating a label from an API data object:
const label = new LabelBuilder({
label: "label",
component,
});
const label = new LabelBuilder({
label: "label",
component,
});
Example
Creating a label using setters and API data:
const label = new LabelBuilder({
label: 'label',
component,
}).setLabel('new text');
const label = new LabelBuilder({
label: 'label',
component,
}).setLabel('new text');
NameTypeOptionalDescription
dataPartial<APILabelComponent>YesThe API data to create this label with
The API data associated with this component.
Inherited from ComponentBuilder
clearDescription():this
Clears the description for this label.
clearId():this
Clears the id of this component, defaulting to a default incremented id.
Inherited from ComponentBuilder
setChannelSelectMenuComponent(input):this
Sets a channel select menu component to this label.
NameTypeOptionalDescription
inputAPIChannelSelectComponent | ChannelSelectMenuBuilder | ((builder: ChannelSelectMenuBuilder) => ChannelSelectMenuBuilder)NoA function that returns a component builder or an already built builder
setDescription(description):this
Sets the description for this label.
NameTypeOptionalDescription
descriptionstringNoThe description to use
setId(id):this
Sets the id (not the custom id) for this component.
NameTypeOptionalDescription
idnumberNoThe id for this component
Inherited from ComponentBuilder
setLabel(label):this
Sets the label for this label.
NameTypeOptionalDescription
labelstringNoThe label to use
setMentionableSelectMenuComponent(input):this
Sets a mentionable select menu component to this label.
NameTypeOptionalDescription
inputAPIMentionableSelectComponent | MentionableSelectMenuBuilder | ((builder: MentionableSelectMenuBuilder) => MentionableSelectMenuBuilder)NoA function that returns a component builder or an already built builder
setRoleSelectMenuComponent(input):this
Sets a role select menu component to this label.
NameTypeOptionalDescription
inputAPIRoleSelectComponent | RoleSelectMenuBuilder | ((builder: RoleSelectMenuBuilder) => RoleSelectMenuBuilder)NoA function that returns a component builder or an already built builder
setStringSelectMenuComponent(input):this
Sets a string select menu component to this label.
NameTypeOptionalDescription
inputAPIStringSelectComponent | StringSelectMenuBuilder | ((builder: StringSelectMenuBuilder) => StringSelectMenuBuilder)NoA function that returns a component builder or an already built builder
setTextInputComponent(input):this
Sets a text input component to this label.
NameTypeOptionalDescription
inputAPITextInputComponent | TextInputBuilder | ((builder: TextInputBuilder) => TextInputBuilder)NoA function that returns a component builder or an already built builder
setUserSelectMenuComponent(input):this
Sets a user select menu component to this label.
NameTypeOptionalDescription
inputAPIUserSelectComponent | UserSelectMenuBuilder | ((builder: UserSelectMenuBuilder) => UserSelectMenuBuilder)NoA function that returns a component builder or an already built builder
Serializes this builder to API-compatible JSON data.
Remarks
This method runs validations on the data before serializing it. As such, it may throw an error if the data is invalid.