Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
89
rated 0 times [  96] [ 7]  / answers: 1 / hits: 11302  / 3 Years ago, fri, august 13, 2021, 12:00:00

How to attach more than 5 buttons to a message with discord-buttons, discord.js?


Example


The way I try:


let Buttons = [];
Buttons[0] = new discordButton.MessageButton().setStyle('gray').setID("0").setLabel(' ');
Buttons[1] = new discordButton.MessageButton().setStyle('gray').setID("1").setLabel(' ');
Buttons[2] = new discordButton.MessageButton().setStyle('gray').setID("2").setLabel(' ');

Buttons[3] = new discordButton.MessageButton().setStyle('gray').setID("3").setLabel(' ');
Buttons[4] = new discordButton.MessageButton().setStyle('gray').setID("4").setLabel(' ');
Buttons[5] = new discordButton.MessageButton().setStyle('gray').setID("5").setLabel(' ');

Buttons[6] = new discordButton.MessageButton().setStyle('gray').setID("6").setLabel(' ');
Buttons[7] = new discordButton.MessageButton().setStyle('gray').setID("7").setLabel(' ');
Buttons[8] = new discordButton.MessageButton().setStyle('gray').setID("8").setLabel(' ');

msg.channel.send(`⁣...`, { buttons:Buttons });

The error it gets:


DiscordAPIError: Invalid Form Body
components[0].components[5]: The specified component exceeds the maximum width
components[0].components[6]: The specified component exceeds the maximum width
components[0].components[7]: The specified component exceeds the maximum width
components[0].components[8]: The specified component exceeds the maximum width

method: 'post',
path: '/channels/656858400440975371/messages',
code: 50035,
httpStatus: 400
}

Does it have something to do with my bot account?


More From » button

 Answers
1

I suggest that you read through or reference the Discord API documentation, here you could find out the following information:



  • Buttons must be sent inside an Action Row

  • An Action Row can contain up to 5 buttons


Reference: https://discord.com/developers/docs/interactions/message-components


[#995] Tuesday, August 3, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
parker

Total Points: 259
Total Questions: 109
Total Answers: 97

Location: Zambia
Member since Thu, Jun 25, 2020
4 Years ago
parker questions
;