提问者:小点点

在一条消息中发送多个嵌入


如何在一条消息中发送多个嵌入?像这样发送多个:

await message.channel.send({embed: { //Send a new embed
        title: "Embed 1",
        fields: [{
            name: "Description",
            value: "The Description"
        }]
    }},
    embed: { //Send a new embed
        title: "Embed 2",
        fields: [{
            name: "Description",
            value: "The Description"
        }]
    }});

输出:

[object Object]
Embed 2
Description: The Description

我找不到任何关于发送多个嵌入的文档,在discord.js文件中提到了它,发送了一个嵌入列表。虽然我试过这个,但它也不起作用。


共1个答案

匿名用户

这当然是可能的,通过使用Webhook发送您的消息!

下面是WebHookMessageOptions的文档,您可以看到embeds选项接受MessageEmbed的数组。

快速示例:

message.channel.createWebhook('Webhook Name', message.author.displayAvatarURL)
.then(w => w.send({embeds: [
    new Discord.MessageEmbed().setAuthor('Embed 1'),
    new Discord.MessageEmbed().setAuthor('Embed 2'),
]}));

这适用于最多10个嵌入。