ButtonBuilder

export class ButtonBuilder extends BuilderButtonComponent
export class ButtonBuilder extends BuilderButtonComponent
Represents a button builder.
constructor(data?)
Constructs a new instance of the ButtonBuilder class
NameTypeOptionalDescription
dataPartial<ButtonComponentData> | Partial<APIButtonComponent>YesNone
Readonly
data:Partial<DataType>
The API data associated with this component.
Inherited from ComponentBuilder
Static
from(other):ButtonBuilder
Creates a new button builder from JSON data
NameTypeOptionalDescription
otherJSONEncodable<APIButtonComponent> | APIButtonComponentNoThe other data
setCustomId(customId):this
Sets the custom id for this button.
Remarks
This method is only applicable to buttons that are not using the Link button style.
NameTypeOptionalDescription
customIdstringNoThe custom id to use
setDisabled(disabled?):this
Sets whether this button is disabled.
NameTypeOptionalDescription
disabledbooleanYesWhether to disable this button
setEmoji(emoji):this
Sets the emoji to display on this button
NameTypeOptionalDescription
emojiComponentEmojiResolvableNoThe emoji to display on this button
setLabel(label):this
Sets the label for this button.
NameTypeOptionalDescription
labelstringNoThe label to use
setStyle(style):this
Sets the style of this button.
NameTypeOptionalDescription
styleButtonStyleNoThe style to use
setURL(url):this
Sets the URL for this button.
Remarks
This method is only available to buttons using the Link button style. Only three types of URL schemes are currently supported: https://, http://, and discord://.
NameTypeOptionalDescription
urlstringNoThe URL to use
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.