How i can do a ping command

How i can do a ping command like this:Screenshot_20200114-093225

this might be worth checking out. DiscordJs Bot Tutorial

alternatively, I run a code server that you can join just tag me if thats easier for you and i will help you as soon as i can. I assume you want someone to give u the code. Not help u write it yourself correct?

Check this out:

Hey @ControlCit1,

The ping command is based on the difference in the time at which the message was posted and the timestamp of the message. This is generally how it works.

var ping = - message.createdTimestamp + " ms";

To make this into a command, just wrap it up like this:

  if (message.content.startsWith(prefix + "ping")) {
    var ping = - message.createdTimestamp + " ms";"Your ping is `" + `${ - message.createdTimestamp}` + " ms`");


Replace prefix with the prefix of your bot.

Hope this helps!


people actually do it like that still? I would be lost without a command handler

1 Like