1
0
Fork 0
cloudservices/src/commands/ping.ts

26 lines
745 B
TypeScript
Raw Normal View History

2019-10-14 23:37:04 -04:00
import { Message } from 'eris';
import Client from '../Client';
import Command from '../class/Command';
2019-10-15 19:10:37 -04:00
import Util from '../Util';
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
}
}