Carbon
Core/Classes

Button

Extends

  • BaseButton

Constructors

Constructor

new Button(data?): Button

Parameters

ParameterType
data?{ additionalData: ComponentAdditionalData; }
data.additionalData?ComponentAdditionalData

Returns

Button

Inherited from

BaseButton.constructor

Properties

PropertyModifierTypeDefault valueDescriptionInherited from
additionalDatapublicnull | ComponentAdditionalDatanull-BaseButton.additionalData
customIdabstractstringundefinedThe custom ID of the componentBaseButton.customId
deferpublicbooleanfalseWhether the component response should be automatically deferredBaseButton.defer
disabledpublicbooleanfalseThe disabled state of the buttonBaseButton.disabled
emoji?publicobjectundefinedThe emoji of the buttonBaseButton.emoji
emoji.animated?publicbooleanundefined--
emoji.id?publicstringundefined--
emoji.namepublicstringundefined--
ephemeralpublicbooleanfalseWhether the component response should be ephemeralBaseButton.ephemeral
id?publicnumberundefined32 bit integer used as an optional identifier for component The id field is optional and is used to identify components in the response from an interaction that aren't interactive components. The id must be unique within the message and is generated sequentially by Discord if left empty. Generation of ids won't use another id that exists in the message if you have one defined for another component.BaseButton.id
isV2readonlyfalsefalse-BaseButton.isV2
labelabstractstringundefinedThe label of the buttonBaseButton.label
stylepublicButtonStyleButtonStyle.PrimaryThe style of the buttonBaseButton.style
typereadonlyButtonundefined-BaseButton.type

Methods

createId()

createId(additionalData): string

Create a custom ID to use for this component that embeds additional data that you want to be handed

Parameters

ParameterTypeDescription
additionalDatanull | ComponentAdditionalDataThe additional data that you want to be passed in this component's custom ID

Returns

string

The custom ID to use

Inherited from

BaseButton.createId


run()

abstract run(interaction): Promise<void>

Parameters

ParameterType
interactionButtonInteraction

Returns

Promise<void>


serialize()

serialize(): APIButtonComponent

Returns

APIButtonComponent

Overrides

BaseButton.serialize

On this page