Been a bit since I worked with DJS V13, How do I add multiple buttons again?

I have this code:
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('png')
.setLabel('❱ PNG')
.setStyle('LINK')
.setURL(user.displayAvatarURL({ format: "png" }))
)
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('png')
.setLabel('❱ PNG')
.setStyle('LINK')
.setURL(user.displayAvatarURL({ format: "png" }))
)
How do I make it an array/object again so I can have more multiple buttons?
5 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP3y ago
Cool. Thank you! I don't understand, where does the comma go? There isn't a {} around new MessageButton and the docs don't have an example... can I add that around new MessageButton ?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP3y ago
Ah, I see. Thanks again!
souji
souji3y ago
i mean, the idea is to .addComponents(1, 2, 3, 4, 5, ...) each component is it's own MessageButton instance it's not much magic, just variable amount of separated arguments, for which you each but a button you could be doing .addComponents(b1, b2, b3, b4) and define bn = new MessageButton()... but the intermediary assignments can be omitted, of course
Want results from more Discord servers?
Add your server