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
+1 -1
View File
@@ -32,7 +32,7 @@ client.registry
['roleplay', 'Roleplay']
])
.registerDefaultGroups()
.registerDefaultCommands({ help: false })
.registerDefaultCommands({ help: false, ping: false })
.registerCommandsIn(path.join(__dirname, 'commands'));
client.on('ready', () => {
+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
`);
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "21.4.2",
"version": "21.4.3",
"description": "A Discord Bot",
"main": "Shard.js",
"scripts": {