Skip to content

Components

github-actions[bot] edited this page Dec 12, 2024 · 4 revisions

Represents a set of Component objects, offering an interface to control, modify, and retrieve Message Components easily. This is the entry point of this library and what this whole thing is about, that is, the builder.

Constructor

Components(data)

Parameter Type Optional
data Components-Resolvable

Properties

Name Type Description
buttons ArrayIterable A cache of all constructed Button objects in this instance.
selectMenus ArrayIterable A cache of all constructed SelectMenu objects in this instance.

Methods

button(data, actionRow)

Parameter Type Optional
data Button-Resolvable/Custom-ID-Resolvable
actionRow number

Constructs a new Button object with the initial provided data; if data is a string it is treated as if it were the id field. actionRow is an optional number of which Action Row this Button should go into.

Returns self.

This method only operates on data in memory.

Returns: Components


removeButton(id)

Parameter Type
id string

Removes a previously constructed Button object with the custom_id of id.

Returns self and the removed Button.

This method only operates on data in memory.

Returns: Components, Button


removeSelectMenu(id)

Parameter Type
id string

Removes a previously constructed SelectMenu object with the custom_id of id.

Returns self and the removed SelectMenu object.

This method only operates on data in memory.

Returns: Components, SelectMenu


selectMenu(data)

Parameter Type
data SelectMenu-Resolvable/Custom-ID-Resolvable

Constructs a new SelectMenu object with the initial provided data; if data is a string it is treated as if it were the id field.

Returns self.

This method only operates on data in memory.

Returns: Components


Clone this wiki locally