发送未定义,嵌入消息问题(编辑)
Send is not defined, embed message problem (edit)
`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}ms\nAPI 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}ms\nAPI latency/"Remote Response time": ${Math.round(message.client.ws.ping)}ms`)
msg.channel.send(Embed1).then(msg => {
msg.edit(Embed2);
});
}
};`
`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}ms\nAPI 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}ms\nAPI latency/"Remote Response time": ${Math.round(message.client.ws.ping)}ms`)
msg.channel.send(Embed1).then(msg => {
msg.edit(Embed2);
});
}
};`