Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

332
Views
Estoy tratando de hacer un comando de ping discord.js con latencia pero muestra este error

Estoy tratando de hacer un comando ping que también muestra la latencia, pero me encuentro con un error y no sé por qué lo muestra, este es el error:

 TypeError: Cannot read properties of undefined (reading 'ping') at Object.execute (C:\Users\Ayush Kumar\Desktop\AniVenture\commands\utility\ping.js:10:74) at Client.<anonymous> (C:\Users\Ayush Kumar\Desktop\AniVenture\index.js:78:11) at Client.emit (node:events:390:28) at MessageCreateAction.handle (C:\Users\Ayush Kumar\Desktop\AniVenture\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14) at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Ayush Kumar\Desktop\AniVenture\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) at WebSocketManager.handlePacket (C:\Users\Ayush Kumar\Desktop\AniVenture\node_modules\discord.js\src\client\websocket\WebSocketManager.js:350:31) at WebSocketShard.onPacket (C:\Users\Ayush Kumar\Desktop\AniVenture\node_modules\discord.js\src\client\websocket\WebSocketShard.js:443:22) at WebSocketShard.onMessage (C:\Users\Ayush Kumar\Desktop\AniVenture\node_modules\discord.js\src\client\websocket\WebSocketShard.js:300:10) at WebSocket.onMessage (C:\Users\Ayush Kumar\Desktop\AniVenture\node_modules\ws\lib\event-target.js:199:18) at WebSocket.emit (node:events:390:28)

Código en ping.js -

 const Discord = require("discord.js"); module.exports = { name: 'ping', cooldown: 4, execute(message, client) { const bot = message.createdTimestamp - Date.now(); const ping = new Discord.MessageEmbed() .setTitle("Pong! :ping_pong:") .setDescription(`Bot latency: \`${bot}ms\`\n API latency: \`${client.ws.ping}ms\``) .setColor("#31e8b7") .setTimestamp() .setFooter(`${message.author.tag}`); message.channel.send({ embeds: [ping] }); }, };

Estoy usando discord.js v13, dígame cómo soluciono este error, gracias.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Intercambia tu (mensaje, cliente) con (cliente, mensaje)

 execute(client, message) { const bot = message.createdTimestamp - Date.now(); const ping = new Discord.MessageEmbed() .setTitle("Pong! :ping_pong:") .setDescription(`Bot latency: \`${bot}ms\`\n API latency: \`${client.ws.ping}ms\``) .setColor("#31e8b7") .setTimestamp() .setFooter(`${message.author.tag}`); message.channel.send({ embeds: [ping] }); }, };
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!