In this lesson, you will learn how to create custom buttons in Discord.js using ActionRowBuilder
and ButtonBuilder
. You will also learn how to style and add text to the button using ButtonStyle
and the setEmoji
method.
We'll need to make these buttons for our book-club message to give users the ability to let us know that they want to be a part of the club.
ActionRowBuilder
and ButtonBuilder
are important, here's what they do:
ActionRowBuilder
is used to create a row of buttons or other action components in a Discord message. This class provides methods for adding buttons, text, and other components to the row, as well as methods for formatting the row.
ButtonBuilder
is used to create individual buttons within the ActionRowBuilder
. This class provides methods for setting the text, emoji, style, and other properties of the button.
By using them both, we are able to create a row of buttons exactly how we want them to look!