简体   繁体   English

Ping 为负值 (Discord.js v13)

[英]Ping has a negative value (Discord.js v13)

Ping outputs a negative value. Ping 输出负值。 I consulted the answer for a correct ping statement , and nothing seems to go wrong.我查阅了正确的 ping 语句的答案,go 似乎没有错。

My ping command:我的 ping 命令:

const Discord = require('discord.js')

module.exports = {
    name: "ping",
    description: "Test Ping to Bot",

    async run (client, message, args) {
        console.log(`${message.createdAt} | ${message.author.tag} ${message.author} : ${message}`)
        const ping = new Discord.MessageEmbed()
        .setTitle('**🏓 PING PONG! 🏓**')
        .setColor("RANDOM")
        .addFields(
            { name: 'Độ trễ của Bot', value: `${Date.now() - message.createdTimestamp}ms` },
            { name: 'Độ trễ của API', value: `${Math.round(client.ws.ping)}ms`, inline: true },
        )
        .setTimestamp()   
        message.channel.send({embeds : [ping]});
    }
}

Output: Output:

平

discord.js 13.0.0-dev.t1628035429.00d5cee discord.js 13.0.0-dev.t1628035429.00d5cee

Fatal amateur mistake.致命的业余错误。 Never use Date.now() with non-local timestamps unless you can somehow guarantee that the server time and your computer time are exactly the same.永远不要将 Date.now() 与非本地时间戳一起使用,除非你能以某种方式保证服务器时间和你的计算机时间完全相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM