Haha-Yes/commands/utility/ping.js

33 lines
850 B
JavaScript
Raw Permalink Normal View History

2018-12-30 01:20:24 +01:00
const { Command } = require('discord-akairo');
2018-12-25 19:17:07 +01:00
2018-12-30 01:20:24 +01:00
class PingCommand extends Command {
2019-01-02 08:09:45 +01:00
constructor() {
super('ping', {
aliases: ['ping', 'hello'],
category: 'utility',
2019-07-09 04:26:30 +02:00
args: [
{
id: 'lazyping',
type: 'string',
}
],
2019-11-09 12:04:01 +01:00
clientPermissions: ['SEND_MESSAGES'],
2019-01-02 08:09:45 +01:00
description: {
2018-12-30 01:20:24 +01:00
content: 'Ping the bot',
usage: '',
examples: ['']
2018-10-09 16:31:23 +02:00
}
2019-01-02 08:09:45 +01:00
});
}
2018-12-30 01:20:24 +01:00
2019-07-09 04:26:30 +02:00
async exec(message, args) {
if (args.lazyping) return message.channel.send('Ping him yourself you lazy ass');
2019-01-02 08:09:45 +01:00
return message.util.reply('Pong!').then(sent => {
const timeDiff = (sent.editedAt || sent.createdAt) - (message.editedAt || message.createdAt);
const text = `🔂\u2000**RTT**: ${timeDiff} ms\n💟\u2000**Heartbeat**: ${Math.round(this.client.ws.ping)} ms`;
2019-01-02 08:09:45 +01:00
return message.util.reply(`Pong!\n${text}`);
});
}
2018-12-30 01:20:24 +01:00
}
2018-10-09 16:31:23 +02:00
2018-12-30 01:20:24 +01:00
module.exports = PingCommand;