Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 6m16s
27 lines
1.1 KiB
TypeScript
Executable File
27 lines
1.1 KiB
TypeScript
Executable File
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() }))
|
|
}
|