Discord.js 14 ping is returning -1

May someone explain me why when I run put this in my code in the ready event :
console.log(client.ws.ping)
console.log(typeof(client.ws.ping))
console.log(client.ws.ping)
console.log(typeof(client.ws.ping))
I get the following output:
-1
number
-1
number
Thanks
8 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Syjalo
Syjalo3y ago
The client is not ready yet Use it in the ready event
GeekCorner
GeekCornerOP3y ago
i do!
Syjalo
Syjalo3y ago
Show the code
GeekCorner
GeekCornerOP3y ago
import { CustomClient } from "..";

module.exports = {
name: "ready",
once: true,

async execute(client:CustomClient) {
console.clear();

console.log(`Logged in as: ${client.user?.tag}`);
console.log(client.ws.ping);

}
};
import { CustomClient } from "..";

module.exports = {
name: "ready",
once: true,

async execute(client:CustomClient) {
console.clear();

console.log(`Logged in as: ${client.user?.tag}`);
console.log(client.ws.ping);

}
};
it returns -1 maybe just disable once
zevnda
zevnda3y ago
Where are you importing CustomClient from? Your path is just ..
Syjalo
Syjalo3y ago
From the root folder?
GeekCorner
GeekCornerOP3y ago
it's basically D.JS client with command collection binded to it Seems fixed, looks like ready isn't emited when ws is connected
Want results from more Discord servers?
Add your server