community-relations/src/commands/ping.ts

23 lines
680 B
TypeScript
Raw Normal View History

2020-04-14 13:15:33 -04:00
import { Message } from 'eris';
import { Client, Command } from '../class';
export default class Ping extends Command {
constructor(client: Client) {
super(client);
this.name = 'ping';
this.description = 'Pings the bot';
this.permissions = 0;
this.enabled = true;
}
public async run(message: Message) {
2020-04-14 21:33:47 -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 (err) {
this.client.util.handleError(err, message, this);
}
2020-04-14 13:15:33 -04:00
}
}