import { MessageFlags } from "discord.js"
import type { ButtonInteraction } from "discord.js"
import { useQueue } from "discord-player"
import { t } from "@/utils/i18n"

export const id = "player_skip"
export async function execute(interaction: ButtonInteraction) {
	const queue = useQueue(interaction.guild?.id ?? "")
	if (!queue) return

	queue.node.skip()
	return interaction.followUp({ content: t(interaction.locale, "player.skipped"), flags: MessageFlags.Ephemeral })
}
