Files
xiao/commands/util/ping.js
T
Daniel Odendahl Jr 0456e9cc5f Fix Ping
2017-05-28 14:00:33 +00:00

25 lines
781 B
JavaScript

const { Command } = require('discord.js-commando');
const { stripIndents } = require('common-tags');
module.exports = class PingCommand extends Command {
constructor(client) {
super(client, {
name: 'ping',
aliases: ['pong', 'ping-pong'],
group: 'util',
memberName: 'ping',
description: 'Checks the bot\'s ping to the Discord server.',
guarded: true
});
}
async run(msg) {
const message = await msg.say('Pinging...');
return message.edit(stripIndents`
:ping_pong: Pong!
**Message Ping:** ${Math.round(message.createdTimestamp - msg.createdTimestamp)}ms
**Heartbeat Ping:** ${Math.round(this.client.ping)}ms
`);
}
};