DiscordPHP Documentation

ComponentsTrait

Trait for builders that use components.

Tags
since
10.42.0

Table of Contents

Properties

$components  : array<string|int, ComponentObject>
Components of the builder.

Methods

addComponent()  : $this
Adds a component to the builder.
addComponents()  : $this
Adds the components to the builder.
setComponents()  : $this
Sets the components of the builder.

Properties

Methods

addComponent()

Adds a component to the builder.

public abstract addComponent(ComponentObject $component) : $this
Parameters
$component : ComponentObject

Component to add.

Tags
since
10.42.0
throws
InvalidArgumentException

Component is not a valid type.

throws
OverflowException

Builder exceeds component limits.

Return values
$this

addComponents()

Adds the components to the builder.

public addComponents(array<string|int, ComponentObject$components) : $this
Parameters
$components : array<string|int, ComponentObject>

Components to add.

Tags
since
10.42.0
throws
InvalidArgumentException

Component is not a valid type.

throws
OverflowException

Builder exceeds component limits.

Return values
$this

setComponents()

Sets the components of the builder.

public setComponents([array<string|int, ComponentObject>|null $components = null ]) : $this
Parameters
$components : array<string|int, ComponentObject>|null = null

Components to set.

Tags
since
10.42.0
throws
InvalidArgumentException

Component is not a valid type.

throws
OverflowException

Builder exceeds component limits.

Return values
$this

        
On this page

Search results