未定义发送,嵌入消息问题(编辑)


`module.exports = {
name: 'lat2',
description: 'Let the Bot display latency/Response Time and API latency',
execute(message, args) {
const Embed1 = {
color: "RANDOM",
description: 'Pinging...',
};
const Embed2 = {
color: "RANDOM",
title: 'Latencies',
description: `Latency/Response Time: ${send.createdTimestamp - message.createdTimestamp}msnAPI latency/"Remote Response time": ${Math.round(message.client.ws.ping)}ms`,
};
message.channel.send({ embed: Embed1 }).then(send => {
send.edit({ embed: Embed2 });
})
}
};`

那么我能不能把整个东西嵌入?因为send is not defined这个东西在非嵌入版本中运行良好。

Discord嵌入消息的构造不同。send()不是一个对象,它是一个函数,你必须使用msg.edit。你应该自己做颜色。

`module.exports = {
name: 'lat2',
description: 'Let the Bot display latency/Response Time and API latency',
execute(message, args) {
let Embed1 = new Discord.MessageEmbed()
.setColor("#"+String(Math.floor(Math.random()*16777215).toString(16)))
.setDescription("Pinging...")
let Embed2 = new Discord.MessageEmbed()
.setColor("#"+String(Math.floor(Math.random()*16777215).toString(16)))
.setTitle("Latencies")
.setDescription(`Latency/Response Time: ${send.createdTimestamp - message.createdTimestamp}msnAPI latency/"Remote Response time": ${Math.round(message.client.ws.ping)}ms`)
msg.channel.send(Embed1).then(msg => {
msg.edit(Embed2);
});
}
};`

最新更新