Ping

I'm starting over creating a bot, I do have a basic JS knowledge but not too much The point is that, while reading docs, i saw the client.ws, in whick i can get the bot's ping, but when I execute the code it says "Cannot read properties of undefined (reading 'ws')"
5 Replies
d.js toolkit
d.js toolkit3w 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! - Marked as resolved by OP
lucatutz
lucatutzOP3w ago
[email protected] node v20.17.0
const { SlashCommandBuilder } = require('discord.js');
const { EmbedBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('[📚 Utility & Info] > See the BOT ping!'),

async execute(interaction, client){
await interaction.reply(`🏓 | Pong
> Latency is **${client.ws.ping}**ms
`)
},
}
const { SlashCommandBuilder } = require('discord.js');
const { EmbedBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('[📚 Utility & Info] > See the BOT ping!'),

async execute(interaction, client){
await interaction.reply(`🏓 | Pong
> Latency is **${client.ws.ping}**ms
`)
},
}
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
lucatutz
lucatutzOP3w ago
it worked, thanks i got it
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server