title: Trouble with Discord.js Ping Numbers
body: <p>So I recently decided to make a <a href="http://www.discord.gg" rel="noreferrer">Discord</a> bot, and had been going through some tutorials with no problem. However, when I tried to make a ping command (you know, the kind that says "Your ping is <code>137 ms</code>"), I got numbers that didn't make sense.</p>
  
  <p>Numbers such as <code>-627 ms</code>, <code>32 ms</code>, <code>1001 ms</code>, <code>-10 ms</code>, <code>238 ms</code>. Basically anything and everything between <code>-1000</code> and <code>1000</code>.</p>
  
  <p>Now correct me if I'm wrong, but I'm pretty sure that getting negative numbers means I'm sending the response before I even ask for it, and I'm almost certain I didn't write a precognitive bot :P</p>
  
  <p>I spent some time online looking for a reason why I was getting strange ping numbers, but I came up with zilch. I thought to myself, "Hmmmm..... maybe I'm generating them wrong." So I looked at how other people generated <em>their</em> numbers with discord.js...</p>
  
  <p>...aaaand I hit a wall. As far as I can tell, no one has ever tried generating ping numbers with discord.js. If they have, they haven't shared their precious findings online. At least, that's what it looks like to me. (if you have a link to such a tutorial or post, please send it to me)</p>
  
  <p>I'm generating the numbers with <code>${Date.now() - message.createdTimestamp}</code> This is the only way I have found to generate them, so if anyone has a better method, I would love to see it.</p>
  
  <p>That snippet fits right in with the rest of my code (and yes, it is a very boring bot):</p>
  
  <pre><code>const Discord = require('discord.js');
  const client = new Discord.Client();
  const token = require('./token.json').token;
  
  client.on('ready', () =&gt; {
      console.log('Bot is up and running!');
  });
  
  var prefix = "?"
  
  client.on('message', message =&gt; {
      if (message.author.bot) return;
      if (!message.content.startsWith(prefix)) return;
  
      if (message.content.startsWith(prefix + 'ping')) {
          message.channel.sendMessage('Pong! Your ping is `' + `${Date.now() - message.createdTimestamp}` + ' ms`');
      }
  });
  
  client.login(token);
  </code></pre>
  
  <p>If anybody could give me a reason why I'm getting negative numbers, or give me a better way to generate them, I would be extremely grateful. Thanks in advance.</p>