mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
26 lines
793 B
JavaScript
26 lines
793 B
JavaScript
const Command = require('../../framework/Command');
|
|
const { stripIndents } = require('common-tags');
|
|
const { formatNumber } = require('../../util/Util');
|
|
|
|
module.exports = class PingCommand extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: 'ping',
|
|
aliases: ['pong', 'ping-pong'],
|
|
group: 'util-public',
|
|
memberName: 'ping',
|
|
description: 'Checks the bot\'s ping to the Discord server.',
|
|
guarded: true
|
|
});
|
|
}
|
|
|
|
async run(msg) {
|
|
const message = await msg.say('Pinging...');
|
|
const ping = Math.round(message.createdTimestamp - msg.createdTimestamp);
|
|
return message.edit(stripIndents`
|
|
🏓 P${'o'.repeat(Math.min(Math.round(ping / 100), 1500))}ng! \`${formatNumber(ping)}ms\`
|
|
Heartbeat: \`${formatNumber(Math.round(this.client.ws.ping))}ms\`
|
|
`);
|
|
}
|
|
};
|