import { Message } from 'eris';
import { Client, CmdContext, Command } from '../class';

export default class Ping extends Command {
  constructor(client: Client) {
    super(client);
    this.name = 'ping';
    this.description = 'Pings the bot';
    this.usage = 'ping';
    this.permissions = 0;
    this.enabled = true;
  }

  public async run(ctx: CmdContext) {
    const clientStart: number = Date.now();
    const msg: Message = await ctx.uniCreateMessage('🏓 Pong!');
    msg.edit(`🏓 Pong!\nClient: \`${Date.now() - clientStart}ms\`\nResponse: \`${msg.createdAt - ctx.message.createdAt}ms\``);
  }
}
