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,26 @@
|
||||
import { SlashCommandBuilder, ChatInputCommandInteraction } from 'discord.js'
|
||||
import { useQueue } from 'discord-player'
|
||||
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('volume')
|
||||
.setDescription('Modifie le volume de la musique.')
|
||||
.addIntegerOption(option => option.setName('volume')
|
||||
.setDescription('Le volume à mettre (%)')
|
||||
.setRequired(true)
|
||||
.setMinValue(1)
|
||||
.setMaxValue(100)),
|
||||
async execute(interaction: ChatInputCommandInteraction) {
|
||||
let volume = interaction.options.getInteger('volume')
|
||||
let queue = useQueue(interaction.guild?.id ?? '')
|
||||
if (!queue) return interaction.followUp({ content: 'Aucune file d\'attente en cours, recherche une musique plutôt !' })
|
||||
|
||||
queue.node.setVolume(volume as number)
|
||||
return await interaction.reply(`Volume modifié à ${volume}% !`)
|
||||
}
|
||||
}
|
||||
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("volume")
|
||||
.setDescription("Change the music volume")
|
||||
.setDescriptionLocalizations({ fr: "Modifie le volume de la musique" })
|
||||
.addIntegerOption(option => option
|
||||
.setName("volume")
|
||||
.setDescription("The volume to set (%)")
|
||||
.setDescriptionLocalizations({ fr: "Le volume à mettre (%)" })
|
||||
.setRequired(true)
|
||||
.setMinValue(0)
|
||||
.setMaxValue(100)
|
||||
)
|
||||
|
||||
export async function execute(interaction: ChatInputCommandInteraction) {
|
||||
const volume = interaction.options.getInteger("volume", true)
|
||||
const queue = useQueue(interaction.guild?.id ?? "")
|
||||
if (!queue) return interaction.followUp({ content: t(interaction.locale, "player.no_queue_search_instead"), flags: MessageFlags.Ephemeral})
|
||||
|
||||
queue.node.setVolume(volume)
|
||||
return interaction.reply(t(interaction.locale, "player.volume_changed", { volume: volume.toString() }))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user