DiscordAPIError: Invalid Form Body - Discord.js Embed

DiscordAPIError: Invalid Form Body - Discord.js Embed

嘿,当它在 slashCommand 上发送时,我试图在我的嵌入中创建一个 url 按钮,但是当我尝试放置按钮并使用命令时,我得到了一个错误: DiscordAPIError: 表单正文无效

我不知道为什么会出现这个错误,而且我的嵌入不是 working/sending。

节点:v17.7.2

Discord.js: 13.2.0

这是我的命令:

const { Client, CommandInteraction } = require("discord.js");
const { MessageEmbed } = require('discord.js');
const ee = require('../../config.json');
const { MessageActionRow, MessageButton } = require('discord.js');

module.exports = {
    name: "help",
    description: "Show all the commands",
    /**
     *
     * @param {Client} client
     * @param {CommandInteraction} interaction
     * @param {String[]} args
     */
    run: async (client, interaction, args) => {

      let music = [
        "\`play:\` Play a song from YouTube, SoundCloud, & Spotify",
        "\`pause:\` Pause the current playing music.",
        "\`resume:\` Resume the pause music.",
        "\`stop:\` Stop the music.",
        '\`loop:\` Loop the current music or the queqe.',
        '\`autoplay:\` Autoplay music for you.',
        '\`queue:\` Show the music queue.',
        '\`volume:\` Adjust the volume of the music.',
        '\`seek:\` Rewind the current song to the specified position.',
        '\`shuffle:\` Shuffle the music playlist or the queue.',
        '\`nowplaying:\` Show the Current music playing.',
        '\`save:\` Save the current playing music.',
        '\`lyrics:`\ Display the lyrics of the current playing music.',
        '`\filter:` Put a filter to a song.'
      ]
      let info = [
        '\`ping:\` Pings H_M.',
        '\`help:\` Shows all the H_M command lists.',
        '\`links:\` Information about H_M.',
        '`\avatar:\` Shows the avatar of a user.'
      ]
        const helpembed = new MessageEmbed()
          .setThumbnail(client.user.displayAvatarURL())
          .setColor(ee.color)
          .setTitle(` | Command list of ${client.user.username}`)
          .setDescription(`** - Music**\n• ${music.join("\n • ")}\n**⚙️ - Information**\n• ${info.join("\n • ")}`)

        const row = new MessageActionRow()
         .addComponents(
           new MessageButton()
           .setLabel('Click here.')
           .setStyle('url')
           .setURL('https://example.com'),
         );
       interaction.followUp({ embeds: [helpembed], components: [row] });
    },
};

我试着按照它在这个文件上的说法:https://discordjs.guide/interactions/buttons.html#building-and-sending-buttons 但是好像我做错了什么...

根据官方 discord.js 按钮指南 => Buttons | Discord.js,您可以将 5 种样式应用于按钮:PRIMARY SECONDARY SUCCESS DANGER LINK。我假设你想创建一个指向某处的按钮 link 所以你的按钮中的样式不是 url,而是将其更改为 LINK 这样它就像这样 = > .setURL('LINK')