ButtonBuilder
Represents a button component
export declare class ButtonBuilder extends ComponentBuilder<APIButtonComponent>
Extends
constructor(data?)
Creates a new button from API data
Example
Creating a button from an API data object
const button = new ButtonBuilder({
style: 'primary',
label: 'Click Me',
emoji: {
name: ':smile:',
id: '12345678901234567890123456789012',
},
custom_id: '12345678901234567890123456789012',
});
Example
Creating a button using setters and API data
const button = new ButtonBuilder({
style: 'primary',
label: 'Click Me',
})
.setEmoji({ name: ':smile:', id: '12345678901234567890123456789012' })
.setCustomId('12345678901234567890123456789012');
Sets the custom id for this button
Remarks
This method is only applicable to buttons that are not using the
Link
button style.Sets the URL for this button
Remarks
This method is only available to buttons using the
Link
button style. Only three types of URL schemes are currently supported: https://
, http://
and discord://