ContainerBuilder

export declare class ContainerBuilder extends ComponentBuilder<APIContainerComponent>
export declare class ContainerBuilder extends ComponentBuilder<APIContainerComponent>

No summary provided.

constructor({ components, ...rest }?)
Constructs a new instance of the ContainerBuilder class
NameTypeOptionalDescription
{ components, ...rest }Partial<APIContainerComponent>YesNone
ProtectedReadonly
addActionRowComponents(...input):this
Adds action row components to this container.
NameTypeOptionalDescription
...inputRestOrArray<ActionRowBuilder | APIActionRowComponent<APIComponentInMessageActionRow> | ((builder: ActionRowBuilder) => ActionRowBuilder)>NoThe action row to add
addFileComponents(...input):this
Adds file components to this container.
NameTypeOptionalDescription
...inputRestOrArray<APIFileComponent | FileBuilder | ((builder: FileBuilder) => FileBuilder)>NoThe file components to add
addMediaGalleryComponents(...input):this
Adds media gallery components to this container.
NameTypeOptionalDescription
...inputRestOrArray<APIMediaGalleryComponent | MediaGalleryBuilder | ((builder: MediaGalleryBuilder) => MediaGalleryBuilder)>NoThe media gallery components to add
addSectionComponents(...input):this
Adds section components to this container.
NameTypeOptionalDescription
...inputRestOrArray<APISectionComponent | SectionBuilder | ((builder: SectionBuilder) => SectionBuilder)>NoThe section components to add
addSeparatorComponents(...input):this
Adds separator components to this container.
NameTypeOptionalDescription
...inputRestOrArray<APISeparatorComponent | SeparatorBuilder | ((builder: SeparatorBuilder) => SeparatorBuilder)>NoThe separator components to add
addTextDisplayComponents(...input):this
Adds text display components to this container.
NameTypeOptionalDescription
...inputRestOrArray<APITextDisplayComponent | TextDisplayBuilder | ((builder: TextDisplayBuilder) => TextDisplayBuilder)>NoThe text display components to add
clearAccentColor():this
Clears the accent color of this container.
clearId():this
Clears the id of this component, defaulting to a default incremented id.
Inherited from ComponentBuilder
setAccentColor(color):this
Sets the accent color of this container.
NameTypeOptionalDescription
colornumberNoThe color to use
setId(id):this
Sets the id of this component.
NameTypeOptionalDescription
idnumberNoThe id to use
Inherited from ComponentBuilder
setSpoiler(spoiler?):this
Sets the spoiler status of this container.
NameTypeOptionalDescription
spoilerbooleanYesThe spoiler status to use
spliceComponents(index, deleteCount, ...components):this
Removes, replaces, or inserts components for this container
Remarks
This method behaves similarly to Array.prototype.splice().It's useful for modifying and adjusting order of the already-existing components of a container.
Example
Remove the first component:
container.spliceComponents(0, 1);
container.spliceComponents(0, 1);
Example
Remove the first n components:
const n = 4;
container.spliceComponents(0, n);
const n = 4;
container.spliceComponents(0, n);
Example
Remove the last component:
container.spliceComponents(-1, 1);
container.spliceComponents(-1, 1);
NameTypeOptionalDescription
indexnumberNoThe index to start at
deleteCountnumberNoThe number of components to remove
...componentsRestOrArray<APIComponentInContainer | ContainerComponentBuilders>NoThe replacing component objects
toJSON(validationOverride?):APIContainerComponent
Serializes this builder to API-compatible JSON data.Note that by disabling validation, there is no guarantee that the resulting object will be valid.
NameTypeOptionalDescription
validationOverridebooleanYesForce validation to run/not run regardless of your global preference