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_resume"
export async function execute(interaction: ButtonInteraction) {
	const queue = useQueue(interaction.guild?.id ?? "")
	if (!queue) return

	queue.node.setPaused(!queue.node.isPaused())
	return interaction.followUp({ content: t(interaction.locale, "player.resumed"), flags: MessageFlags.Ephemeral })
}
