const now = require('performance-now');
const Command = require('../Command');

class PingCommand extends Command {
  constructor(bot) {
    super(bot);
    this.props.help = {
      name: 'ping',
      description: 'ping, pong',
      usage: 'ping',
    };
  }
  run(msg) {
    const startTime = now();
    return msg.channel.sendMessage(`⏱ Pinging...`).then(message => {
      const endTime = now();
      let difference = (endTime - startTime).toFixed(0);
      if (difference > 1000) difference = (difference / 1000).toFixed(0);
      let differenceText = (endTime - startTime) > 999 ? 's' : 'ms';
      return message.edit(`⏱ Ping, Pong! Took ${difference} ${differenceText}`);
    });
  }
}

module.exports = PingCommand;

@@ -1,44 +1,4 @@
-const now = require('performance-now');%0A
 cons
@@ -32,16 +32,16 @@
 mand');%0A
+
 %0Aclass P
@@ -246,29 +246,44 @@
 startTime = 
-now()
+msg.createdTimestamp
 ;%0A    return
@@ -367,13 +367,32 @@
 e = 
-now()
+message.createdTimestamp
 ;%0A  
@@ -631,16 +631,39 @@
  Pong! T
+he message round-trip t
 ook $%7Bdi
@@ -689,16 +689,69 @@
 nceText%7D
+. The heartbeat ping is $%7Bthis.bot.ping.toFixed(0)%7Dms
 %60);%0A    

Update Command: ping - added heartbeat ping, removed performance-now usage