Custom Ping Command

This commit is contained in:
Daniel Odendahl Jr
2017-05-28 13:55:48 +00:00
parent 4a1813f172
commit ad982c6533
3 changed files with 26 additions and 2 deletions
+24
View File
@@ -0,0 +1,24 @@
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(msg.createdTimestamp - message.createdTimestamp)}ms
**Heartbeat Ping:** ${Math.round(this.client.ping)}ms
`);
}
};