Jus*_*sha 1 javascript button discord
如何使用discord-buttons、discord.js 将超过 5 个按钮附加到消息中?
\n\n我尝试的方式:
\nlet Buttons = [];\n Buttons[0] = new discordButton.MessageButton().setStyle(\'gray\').setID("0").setLabel(\' \');\n Buttons[1] = new discordButton.MessageButton().setStyle(\'gray\').setID("1").setLabel(\' \');\n Buttons[2] = new discordButton.MessageButton().setStyle(\'gray\').setID("2").setLabel(\' \');\n\n Buttons[3] = new discordButton.MessageButton().setStyle(\'gray\').setID("3").setLabel(\' \');\n Buttons[4] = new discordButton.MessageButton().setStyle(\'gray\').setID("4").setLabel(\' \');\n Buttons[5] = new discordButton.MessageButton().setStyle(\'gray\').setID("5").setLabel(\' \');\n \n Buttons[6] = new discordButton.MessageButton().setStyle(\'gray\').setID("6").setLabel(\' \');\n Buttons[7] = new discordButton.MessageButton().setStyle(\'gray\').setID("7").setLabel(\' \');\n Buttons[8] = new discordButton.MessageButton().setStyle(\'gray\').setID("8").setLabel(\' \');\n\nmsg.channel.send(`\xe2\x81\xa3...`, { buttons:Buttons });\nRun Code Online (Sandbox Code Playgroud)\n它得到的错误:
\nDiscordAPIError: Invalid Form Body\ncomponents[0].components[5]: The specified component exceeds the maximum width\ncomponents[0].components[6]: The specified component exceeds the maximum width\ncomponents[0].components[7]: The specified component exceeds the maximum width\ncomponents[0].components[8]: The specified component exceeds the maximum width\n\nmethod: \'post\',\n path: \'/channels/656858400440975371/messages\',\n code: 50035,\n httpStatus: 400\n}\nRun Code Online (Sandbox Code Playgroud)\n这和我的机器人账户有关系吗?
\n您可以尝试这样做:
const msg = await message.channel.send({
embed: YOUR EMBED HERE,
components: [
{
type: 1,
components: [Button[0], Button[1], Button[2], Button[3], Button[4]],
},
{
type: 1,
components: [more, buttons, here, max, 5]
}
{
type: 1,
components: [you, can, do, 5, times]
}
]
});
Run Code Online (Sandbox Code Playgroud)
我希望这有帮助:D