所以我已经在这里和那里问过了,但是我没有找到解决错误的方法:ReferenceError:send is not defined
在非嵌入版本中,一切正常,但在这里却行不通。
module.exports = {
name: 'lat2',
description: 'Let the Bot display latency/Response Time and API latency/"Remote Response time"',
execute(message, args) {
const Discord = require('discord.js');
let Embed1 = new Discord.MessageEmbed()
.setColor(0x0099ff)
.setDescription("Pinging...")
let Embed2 = new Discord.MessageEmbed()
.setColor(0x0099ff)
.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);
});
}
};
答案 0 :(得分:1)
问题不是发送消息,而是抱怨${send.createdTimestamp}
,因为您没有在此处的任何位置定义“发送”。
尝试将其替换为message.createdAt
要继续获得延迟,请尝试以下操作:
module.exports = {
name: 'lat2',
description: 'Let the Bot display latency/Response Time and API latency/"Remote Response time"',
execute(message, args) {
const Discord = require('discord.js');
let Embed1 = new Discord.MessageEmbed()
.setColor(0x0099ff)
.setDescription("Pinging...")
msg.channel.send(Embed1).then(m => {
let Embed2 = new Discord.MessageEmbed()
.setColor(0x0099ff)
.setTitle("Latencies")
.setDescription(`Latency/Response Time: ${m.createdTimestamp - message.createdTimestamp}ms\nAPI latency/"Remote Response time": ${Math.round(message.client.ws.ping)}ms`)
m.edit(Embed2);
});
}
};