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

23 lines
679 B
TypeScript
Raw Normal View History

2019-10-14 23:37:04 -04:00
import { Message } from 'eris';
2019-10-18 18:16:32 -04:00
import { Client } from '..';
2019-10-15 20:34:13 -04:00
import { Command } from '../class';
2019-10-14 18:02:04 -04:00
export default class Ping extends Command {
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.client.util.handleError(error, message, this);
2019-10-15 19:10:37 -04:00
}
2019-10-14 23:37:04 -04:00
}
}