Bot not returning API latency

Hello, I'm trying to make my bot return API latency but it is responding with NaN. In my code, API latency is defined as const apiLatency = client.ws.ping;. I also tried putting console.log(client.ws.ping) but it still returned NaN. So I can't figure out whats the problem.
4 Replies
d.js toolkit
d.js toolkit5mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Konrad
KonradOP5mo ago
Shows on the tag, 14.15.3 const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMessages] }); Ok yeah, that question made me realize the problem. I defined the client in the main.js of my "general plugin" instead of requiring the one from index.js
sey†
sey†5mo ago
Try to log it 1 minute after the bot startup During 1 minute, the ping equals -1 for any reason
Want results from more Discord servers?
Add your server