Search...

ComponentBuilder

export declare abstract class ComponentBuilder<DataType extends Partial<APIBaseComponent<ComponentType>> = APIBaseComponent<ComponentType>> implements JSONEncodable<AnyAPIActionRowComponent> 
export declare abstract class ComponentBuilder<DataType extends Partial<APIBaseComponent<ComponentType>> = APIBaseComponent<ComponentType>> implements JSONEncodable<AnyAPIActionRowComponent> 
Represents a discord component
NameConstraintsOptionalDefaultDescription
DataTypePartial<APIBaseComponent<ComponentType>>YesAPIBaseComponent<ComponentType>The type of internal API data that is stored within the component

constructor(data)

Constructs a new instance of the ComponentBuilder class
NameTypeOptionalDescription
dataPartial<DataType>NoNone
Readonly

data

:

Partial<DataType>

The API data associated with this component
Serializes this component to an API-compatible JSON object
Remarks
This method runs validations on the data before serializing it. As such, it may throw an error if the data is invalid.