const client = require('../index.js');
module.exports = {
name: 'latency',
aliases: ['lat'],
description: 'Let the Bot display your latency.',
execute(message, args) {
const m = message.channel.send("Pinging...");
m.edit(`Your latency latency is ${m.createdTimestamp - message.createdTimestamp}ms.\nAPI Latency is ${Math.round(client.ws.ping)}ms`);
message.delete().catch(O_o=>{});
return
}
};
So it sends "Pinging" but then I get the error:
Cannot read property 'ping' of undefined
and I don't know how or where I should define ping, does someone know?
Your issue seems like it's being caused by the way you're importing client
, the best thing to do to fix your issue is by passing client
in your execute()
function in your command files and in your index.js