Components - Bilal2453/discordia-components Wiki

Represents a set of Component objects, offering an interface to control, modify, and retrieve 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


raw()

Returns a table value of what the raw value Discord would accept is like based on assumptions of the current components.

By design, user should never need to use this method.

This method only operates on data in memory.

Returns: table


removeAllComponents()

Removes all components attached to this instance and reset its cache.

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