#Potentially silly question for

1 messages · Page 1 of 1 (latest)

lavish granite
#

My code sits like this:

let row = new ActionRowBuilder();

for (let id in config.buttons) {
    if (!Object.hasOwn(config.buttons,id)) { continue; }

    let button = config.buttons[id];
    row.addComponents(new ButtonBuilder()
        .setCustomId('role_' + id)
        .setLabel(button[2])
        .setStyle(ButtonStyle[button[1]])
    );
}

let chan = discordjs.client.channels.cache.get(config.channels.role_apply);
func.channel_send(chan,'',[],[],[row]).then();
#

If I limit the size of the array config.buttons to one, the button insert works fine, but it seems that I can't call row.addComponents() more than once, or I get the error Invalid Form Body

tulip roost
#

you need to use channel.send({ content: "...", components: [row] })

lavish granite
#

yeah that's handled by func.channel_send

#

if i break the array iteration after one run, it works fine, but more than one and it just errors out