gpt4 book ai didi

javascript - Ping 问题discord.js

转载 作者:行者123 更新时间:2023-12-02 21:05:07 25 4
gpt4 key购买 nike

https://gyazo.com/fce96f41aee0160e197981d1646600a2

bot.on('message', msg=> { 
if(msg.content == "ping"){
msg.reply("Asteapta...")
.then((msg) => { // Resolve promise
msg.edit("> Pingul este: " + (Date.now() - msg.createdTimestamp)+" milisecunde") // Edits message with current timestamp minus timestamp of message
});
}
})

正如您在视频中看到的,ping 显示为负且数字很大。请帮忙!

最佳答案

如果 Date.now() 大于 msg.createdTimestamp,它将给出负数。

Date.now() - (Date.now() + 1400) = -1400

将其更改为相反:

(Date.now() + 1400) - Date.now() = 1400

您的代码已更改:

(msg.createdTimestamp - Date.now())

关于javascript - Ping 问题discord.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61250089/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com