muskytape
Version:
Framework não oficial do Discord.js
29 lines (26 loc) • 794 B
JavaScript
const { oneLine } = require('common-tags');
const Command = require('../base');
module.exports = class PingCommand extends Command {
constructor(client) {
super(client, {
name: 'ping',
group: 'util',
memberName: 'ping',
description: 'Verifica o ping do bot no servidor do Discord.',
throttling: {
usages: 5,
duration: 10
}
});
}
async run(msg) {
const pingMsg = await msg.reply('Pinging...');
return pingMsg.edit(oneLine`
${msg.channel.type !== 'dm' ? `${msg.author},` : ''}
Pong! A viagem de ida e volta da mensagem levou ${
(pingMsg.editedTimestamp || pingMsg.createdTimestamp) - (msg.editedTimestamp || msg.createdTimestamp)
}ms.
${this.client.ws.ping ? `O ping de pulsação é ${Math.round(this.client.ws.ping)}ms.` : ''}
`);
}
};