Réécriture complète 4.0
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 6m16s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 6m16s
This commit is contained in:
@@ -1,21 +1,29 @@
|
||||
import { ChatInputCommandInteraction, SlashCommandBuilder } from 'discord.js'
|
||||
import { useQueue } from'discord-player'
|
||||
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('loop')
|
||||
.setDescription('Boucler la musique en cours de lecture.')
|
||||
.addIntegerOption(option => option.setName('loop')
|
||||
.setDescription('Mode de boucle (0 = Off, 1 = Titre, 2 = File d\'Attente; 3 = Autoplay)')
|
||||
.setRequired(true)
|
||||
.setMinValue(0)
|
||||
.setMaxValue(3)),
|
||||
async execute(interaction: ChatInputCommandInteraction) {
|
||||
let loop = interaction.options.getInteger('loop')
|
||||
let queue = useQueue(interaction.guild?.id ?? '')
|
||||
if (!queue) return interaction.followUp({ content: 'Aucune file d\'attente en cours, recherche une musique plutôt !' })
|
||||
|
||||
queue.setRepeatMode(loop as number)
|
||||
return await interaction.reply(`Boucle ${loop === 0 ? 'désactivée' : loop === 1 ? 'en mode Titre' : loop === 2 ? 'en mode File d\'Attente' : 'en autoplay'}.`)
|
||||
}
|
||||
}
|
||||
import { SlashCommandBuilder } from "discord.js"
|
||||
import type { ChatInputCommandInteraction } from "discord.js"
|
||||
import { useQueue } from "discord-player"
|
||||
import type { QueueRepeatMode } from "discord-player"
|
||||
import { t } from "@/utils/i18n"
|
||||
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName("loop")
|
||||
.setDescription("Loop the current music")
|
||||
.setNameLocalizations({ fr: "boucle" })
|
||||
.setDescriptionLocalizations({ fr: "Boucler la musique en cours de lecture" })
|
||||
.addIntegerOption(option => option
|
||||
.setName("mode")
|
||||
.setDescription("Loop mode (0 = Off | 1 = Track | 2 = Queue | 3 = Autoplay)")
|
||||
.setDescriptionLocalizations({ fr: "Mode de boucle (0 = Arrêt | 1 = Titre | 2 = File d'Attente | 3 = Autoplay)" })
|
||||
.setRequired(true)
|
||||
.setMinValue(0)
|
||||
.setMaxValue(3)
|
||||
)
|
||||
|
||||
export async function execute(interaction: ChatInputCommandInteraction) {
|
||||
const mode = interaction.options.getInteger("mode", true)
|
||||
const queue = useQueue(interaction.guild?.id ?? "")
|
||||
if (!queue) return interaction.followUp({ content: t(interaction.locale, "player.no_queue") })
|
||||
|
||||
queue.setRepeatMode(mode as QueueRepeatMode)
|
||||
|
||||
return interaction.reply(t(interaction.locale, mode === 0 ? "player.loop_off" : mode === 1 ? "player.loop_track" : mode === 2 ? "player.loop_queue" : "player.loop_autoplay"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user