Bot 有 sending/editing 嵌入消息的问题

Bot has roblem with sending/editing embed messages

所以我已经四处询问,但我没有找到如何修复 eroor: 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);
            });
        }
    };

问题不在于发送消息,而是关于 ${send.createdTimestamp} 的抱怨,因为您没有在那里的任何地方定义 "send"。 尝试将其替换为 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);
            });
        }
    };