import { SlashCommandBuilder, ChatInputCommandInteraction } from "discord.js";
// No need to import BotClient if not used directly in execute

export default {
  // Use export default for ES Modules
  data: new SlashCommandBuilder().setName("ping").setDescription("Replies with Pong!"),
  async execute(_interaction: ChatInputCommandInteraction) {
    // Add _interaction type
    // Calculate latency (optional but common for ping commands)
    const sent = await _interaction.reply({
      content: "Pinging...",
      fetchReply: true,
      ephemeral: true,
    });
    const latency = sent.createdTimestamp - _interaction.createdTimestamp;
    const wsPing = _interaction.client.ws.ping; // WebSocket heartbeat ping

    await _interaction.editReply(
      `Pong! 🏓\nRoundtrip latency: ${latency}ms\nWebSocket Ping: ${wsPing}ms`,
    );
  },
};
