Component - Bilal2453/discordia-components Wiki

Represents any Message Component, all other components classes should inherit from this.

This is an abstract base class. Direct instances should never exist.

Properties

Name Type Description
actionRow number The Action Row this component is using.
disabled boolean Whether the current component is disabled or not.
id string The component custom_id. Nil for some components such as Link Buttons.
type number The component type. See componentType enumeration for further info.

Methods

disable()

Sets the disabled field to true.

Returns self.

This method only operates on data in memory.

Returns: Component


enable()

Sets the disabled field to false.

Returns self.

This method only operates on data in memory.

Returns: Component


get(property)

Parameter Type
property string

Returns the value of the provided property name.

This method only operates on data in memory.

Returns: any


raw()

Returns a table value of what the raw value Discord would accept is like based on assumptions of the current component's field names.

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

This method only operates on data in memory.

Returns: table


set(property, value)

Parameter Type Optional
property string/table
value any

Sets the provided field(s) value. If property is a table, value is ignored; the key of an entry is treated as the field name, and its value is the field's value. Otherwise if property is a string, value is required. Keep in mind this will validate the inputs and error if not valid.

This method only operates on data in memory.

Returns: Component