如何通过编辑从嵌入中删除字段?

问题描述 投票:0回答:1

所以我想说我创建了一个嵌入并将其发送到一个频道。这是嵌入:

const embed = new Discord.RichEmbed()
        .setColor(color)
        .setTitle(`${message.author.tag} wants to play.`)
        .setAuthor(message.author.tag, message.author.displayAvatarURL)
        .setDescription(game)
        .setThumbnail(icon)
        .addField(`\u200b\n**React with ${emoji} to join.**`, "Remove your reaction to leave.");

一旦发送,我想编辑嵌入的标题和描述,并删除我在最后添加的字段。

这是我正在尝试创建的新嵌入:

const embed = new Discord.RichEmbed(reaction.message.embeds[0])
            .setTitle("This game has ended.")
            .setDescription("You can no longer join.");

这会更改标题和说明,但我不确定如何删除我添加的字段。

javascript discord discord.js
1个回答
1
投票

对不起,我误会了。您可以手动将属性设置为新嵌入对象的embed.fields,为null。 here是RichEmbed属性的文档。

在您的特定情况下,要删除您可能执行的所有字段:

embed.fields = null;
© www.soinside.com 2019 - 2024. All rights reserved.