Components - Bilal2453/discordia-components GitHub Wiki
ComponentsContainer
extendsRepresents 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. |
ComponentsContainer
Methods Inherited Fromraw()
Returns a table of the raw components data the Discord API expects. User should never need to use this method. You are likely doing something wrong if you are using it directly.
Returns: table
removeAllComponents()
Removes all components attached to this instance and reset its cache.
Returns self.
Returns: Components
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