I am facing a challenge with sending buttons from an array. I have tested the code below, but it sends two different messages with buttons:
array.flatMap(user => {
const cs = new client.discord.MessageActionRow()
.addComponents(
new client.discord.MessageButton()
.setLabel(user.type)
.setURL(${user.id})
.setEmoji('979681456781635700')
.setStyle('LINK')
);
const ch = client.channels.cache.get('998376140326256158');
ch.send({
embeds: [embed],
components: [cs, ]
})
})
Here is my array:
[
{
id: '08933438391',
type: 'ejx1'
},
{
id: '12361425430',
type: 'ejx3'
}
]
The array may contain 4 id and type pairs, or 3, or any other number (but not more than 10).