MessageButton
classe · Source
Represents a button message component.
Extends: BaseMessageComponent
Constructor
Parameters
| Name | Type | Description |
|---|---|---|
data? | MessageButton | MessageButtonOptions | MessageButton to clone or raw data Default: {}. |
Properties
label
nullable
The text to be displayed on this button Source
customId
nullable
A unique string to be sent in the interaction when clicked Source
style
nullable
The style of this button Source
emoji
nullable
Emoji for this button Source
url
nullable
The URL this button links to, if it is a Link style button Source
disabled
Whether this button is currently disabled Source
type
nullable
The type of this component Source
data
The data for this component Source
id
readonly
The id of this component Source
Methods
setCustomId
Sets the custom id for this button Parameters
| Name | Type | Description |
|---|---|---|
customId | string | A unique string to be sent in the interaction when clicked |
Returns: MessageButtonSource
setDisabled
Sets the interactive status of the button Parameters
| Name | Type | Description |
|---|---|---|
disabled? | boolean | Whether this button should be disabled Default: true. |
Returns: MessageButtonSource
setEmoji
Set the emoji of this button Parameters
| Name | Type | Description |
|---|---|---|
emoji | EmojiIdentifierResolvable | The emoji to be displayed on this button |
Returns: MessageButtonSource
setLabel
Sets the label of this button Parameters
| Name | Type | Description |
|---|---|---|
label | string | The text to be displayed on this button |
Returns: MessageButtonSource
setStyle
Sets the style of this button Parameters
| Name | Type | Description |
|---|---|---|
style | MessageButtonStyleResolvable | The style of this button |
Returns: MessageButtonSource
setURL
Sets the URL of this button. MessageButton#style must be LINK when setting a URL Parameters
| Name | Type | Description |
|---|---|---|
url | string | The URL of this button |
Returns: MessageButtonSource
toJSON
Transforms the button to a plain object. Returns: APIMessageButton — The raw data of this button Source
resolveStyle
static · private
Resolves the style of a button Parameters
| Name | Type | Description |
|---|---|---|
style | MessageButtonStyleResolvable | The style to resolve |
Returns: MessageButtonStyleSource