Luk*_*ers 2 javascript discord discord.js
假设我创建了一个嵌入并将其发送到一个频道。这是嵌入的:
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.");
Run Code Online (Sandbox Code Playgroud)
发送后,我想编辑该嵌入的标题和描述,然后删除我在末尾添加的字段。
这是我正在尝试创建的新嵌入:
const embed = new Discord.RichEmbed(reaction.message.embeds[0])
.setTitle("This game has ended.")
.setDescription("You can no longer join.");
Run Code Online (Sandbox Code Playgroud)
这会更改标题和描述,但我不确定如何删除我添加的字段。
小智 8
我知道这已经是 6 个月前的事了,但如果其他人像我一样在这里绊倒,你不应该将 embed.fields 设置为 null。这可以防止以后使用 addField 方法添加新字段。而是将其设置为空数组。
embed.fields = [];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9092 次 |
| 最近记录: |