【发布时间】:2020-08-03 06:44:20
【问题描述】:
如何使用我的机器人编辑发送的嵌入?首先我构建了一个嵌入:
const countdownEmbed = {
color: 0x0099ff,
title:('Countdown'),
author: {
name:`${user_name}`,
icon_url: `${user_pfp}`,
},
description: 'Your countdown starts in **3 seconds**',
thumbnail: {
url: `${client_pfp}`,
},
timestamp: new Date(),
footer: {
text: `© ${client_name}`,
icon_url: `${client_pfp}`,
},
};
然后我做了一个新的嵌入:
const countdownEmbed2 = {
title:("New title!"),
description: 'Your countdown starts in **2 seconds**',
};
创建“更新”嵌入后,我尝试发送消息,然后在一秒钟后对其进行编辑:
message.channel.send({ embed: countdownEmbed })
.then((msg)=> {
setTimeout(function(){
msg.edit(countdownEmbed2);
}, 1000)
});
我的代码只发送初始嵌入,不对其进行编辑。但是,如果我将 msg.edit(countdownEmbed2) 中的 CountEmbed2 更改为字符串,它将在 Discord 中编辑消息本身,而不是嵌入。有没有办法来解决这个问题?还是有更简单的方法来编辑嵌入?
【问题讨论】:
标签: discord.js