2019-10-14 23:37:04 -04:00
|
|
|
import { Message } from 'eris';
|
2019-10-15 20:34:13 -04:00
|
|
|
import { Client, Util } from '..';
|
|
|
|
import { Command } from '../class';
|
2019-10-14 18:02:04 -04:00
|
|
|
|
|
|
|
export default class Ping extends Command {
|
2019-10-15 19:10:37 -04:00
|
|
|
util: Util = new Util(this.client)
|
|
|
|
|
2019-10-14 23:37:04 -04:00
|
|
|
constructor(client: Client) {
|
|
|
|
super(client);
|
|
|
|
this.name = 'ping';
|
|
|
|
this.description = 'Pings the bot';
|
2019-10-15 18:38:49 -04:00
|
|
|
this.enabled = true;
|
2019-10-14 23:37:04 -04:00
|
|
|
}
|
2019-10-14 18:02:04 -04:00
|
|
|
|
2019-10-14 23:37:04 -04:00
|
|
|
public async run(message: Message) {
|
2019-10-15 19:10:37 -04:00
|
|
|
try {
|
|
|
|
const clientStart: number = Date.now();
|
|
|
|
const msg: Message = await message.channel.createMessage('🏓 Pong!');
|
|
|
|
msg.edit(`🏓 Pong!\nClient: \`${Date.now() - clientStart}ms\`\nResponse: \`${msg.createdAt - message.createdAt}ms\``);
|
|
|
|
} catch (error) {
|
|
|
|
this.util.handleError(error, message, this);
|
|
|
|
}
|
2019-10-14 23:37:04 -04:00
|
|
|
}
|
|
|
|
}
|