Bot ping 即将到来
Bot ping is coming nan
我正在尝试 ping 的代码,但结果是这样的.. 编码新手将不胜感激任何帮助...
代码如下:
module.exports = {
name: 'ping' ,
description: "this is a ping command.",
execute(message, arguments, client) {
message.reply('Calculating ping...').then((resultmessage) => {
const ping = resultmessage.createdtimestamp - message.createdtimestamp
resultmessage.edit(`Bot latency: ${ping}`)
})
}
}
我正在使用命令处理程序..主要代码是。
if(command === 'ping'){
client.commands.get('ping').execute(message, args,client);
这是什么输出和它的坏...
机器人延迟:NaN
这是因为属性(在本例中为 createdtimestamp
)区分大小写。所以你需要将 createdtimestamp
替换为 createdTimestamp
.
module.exports = {
name: 'ping' ,
description: "this is a ping command.",
execute(message,arguments,client){
message.reply('Calculating ping...').then((resultmessage) => {
const ping = resultmessage.createdTimestamp - message.createdTimestamp
resultmessage.edit(`Bot latency: ${ping}`)
})
}
}
我正在尝试 ping 的代码,但结果是这样的.. 编码新手将不胜感激任何帮助...
代码如下:
module.exports = {
name: 'ping' ,
description: "this is a ping command.",
execute(message, arguments, client) {
message.reply('Calculating ping...').then((resultmessage) => {
const ping = resultmessage.createdtimestamp - message.createdtimestamp
resultmessage.edit(`Bot latency: ${ping}`)
})
}
}
我正在使用命令处理程序..主要代码是。
if(command === 'ping'){
client.commands.get('ping').execute(message, args,client);
这是什么输出和它的坏... 机器人延迟:NaN
这是因为属性(在本例中为 createdtimestamp
)区分大小写。所以你需要将 createdtimestamp
替换为 createdTimestamp
.
module.exports = {
name: 'ping' ,
description: "this is a ping command.",
execute(message,arguments,client){
message.reply('Calculating ping...').then((resultmessage) => {
const ping = resultmessage.createdTimestamp - message.createdTimestamp
resultmessage.edit(`Bot latency: ${ping}`)
})
}
}