Dynamically adding buttons component to interaction
Good day were trying to add buttons to a interaction reply
Create buttons dynamically - then add the array to the "new ActionRowBuilder().addComponents()" command, fails and gives this error "DiscordAPIError[50035]: Invalid Form Body
components[0].components[BASE_TYPE_BAD_LENGTH]: Must be between 1 and 5 in length."
10 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!npm list discord.js version = 14.13.0
node version = 21.6.0
This is my code
You probably have more than 5 buttons in that row, which exceeds the maximum
Oh so is not possible to have more than 5 buttons
Not in one row, but you can have have more rows with more buttons
How would I add a second row
You'd have to initialize another
ActionRowBuilder
(for example "buttonRow2"), add the new buttons in that row, and then send both rows in the components:
parameter,
Thank alot i tried it now with 5 buttons and it works now, will a a second row now
Alright, good luck
Ty