import { SlashCommandBuilder } from "discord.js";
import type { CommandModule } from "../../discord/types.js";
import { musicPlayer } from "../../services/music/music-player.js";

export const stopCommand: CommandModule = {
  data: new SlashCommandBuilder().setName("stop").setDescription("대기열을 비웁니다"),
  async execute(interaction) {
    if (!interaction.guildId) return;
    try {
      const message = await musicPlayer.stop(interaction.guildId);
      await interaction.reply(message);
    } catch (error) {
      await interaction.reply({
        content: `중지 실패: ${error instanceof Error ? error.message : "알 수 없는 오류"}`,
        ephemeral: true,
      });
    }
  },
};
