Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 5m5s
23 lines
1.2 KiB
TypeScript
23 lines
1.2 KiB
TypeScript
import { SlashCommandBuilder, MessageFlags } from "discord.js"
|
|
import type { ChatInputCommandInteraction } from "discord.js"
|
|
import { useQueue } from "discord-player"
|
|
import { t } from "@/utils/i18n"
|
|
|
|
export const data = new SlashCommandBuilder()
|
|
.setName("queue")
|
|
.setDescription("Get the queue")
|
|
.setNameLocalizations({ fr: "file" })
|
|
.setDescriptionLocalizations({ fr: "Récupérer la file d'attente." })
|
|
|
|
export async function execute(interaction: ChatInputCommandInteraction) {
|
|
const queue = useQueue(interaction.guild?.id ?? "")
|
|
if (!queue) return interaction.reply({ content: t(interaction.locale, "player.no_queue_search_instead"), flags: MessageFlags.Ephemeral})
|
|
if (!queue.currentTrack) return interaction.reply({ content: t(interaction.locale, "player.no_track_playing"), flags: MessageFlags.Ephemeral})
|
|
|
|
const track = `[${queue.currentTrack.title}](${queue.currentTrack.url})`
|
|
const tracks = queue.tracks.map((track, index) => { return `${index + 1}. [${track.title}](${track.url})` })
|
|
if (tracks.length === 0) return interaction.reply({ content: t(interaction.locale, "player.now_playing_no_queue", { track }) })
|
|
|
|
return interaction.reply({ content: t(interaction.locale, "player.now_playing_with_queue", { track, tracks: tracks.join("\n") }) })
|
|
}
|