import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder } from "discord.js" import { ICommand } from "~/typings" import leave from "./music/leave" import nowplaying from "./music/nowplaying" import pause from "./music/pause" import play from "./music/play" import queue from "./music/queue" import repeat from "./music/repeat" import skip from "./music/skip" import unpause from "./music/unpause" import volume from "./music/volume" export default { name: "music", description: "Subcommands for music commands", dev: true, public: false, subcommands: true, data: new SlashCommandBuilder() .setName("music") .setDescription("Subcommands for music commands") .addSubcommand(subcommand => subcommand .setName("play") .setDescription("Play a song") .addStringOption(option => option .setName("query") .setDescription("The song to play") .setAutocomplete(true) .setRequired(true) ) ) .addSubcommand(subcommand => subcommand .setName("volume") .setDescription("Change the volume of the music") .addNumberOption(option => option .setName("volume") .setDescription("The volume to set") .setMinValue(1) .setMaxValue(100) .setRequired(true) ) ) .addSubcommand(subcommand => subcommand .setName("skip") .setDescription("Skip the current song") .addNumberOption(option => option .setName("amount") .setDescription("The amount of songs to skip") ) ) .addSubcommand(subcommand => subcommand .setName("repeat") .setDescription("Set repeat mode") .addStringOption(option => option .setName("mode") .setDescription("The repeat mode") .addChoices( { name: "Off", value: "off" }, { name: "Track", value: "track" }, { name: "Queue", value: "queue" } ) .setRequired(true) ) ) .addSubcommand(subcommand => subcommand .setName("queue") .setDescription("Show the queue") ) .addSubcommand(subcommand => subcommand .setName("nowplaying") .setDescription("Show the currently playing song") ) .addSubcommand(subcommand => subcommand .setName("pause") .setDescription("Pause the music") ) .addSubcommand(subcommand => subcommand .setName("unpause") .setDescription("Unpause the music") ) .addSubcommand(subcommand => subcommand .setName("leave") .setDescription("Leave the voice channel") ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setContexts(InteractionContextType.Guild), async execute({ interaction }) { const subcommand = interaction.options.getSubcommand() if (subcommand === "play") { play(interaction) return } if (subcommand === "volume") { volume(interaction) return } if (subcommand === "skip") { skip(interaction) return } if (subcommand === "repeat") { repeat(interaction) return } if (subcommand === "queue") { queue(interaction) return } if (subcommand === "nowplaying") { nowplaying(interaction) return } if (subcommand === "pause") { pause(interaction) return } if (subcommand === "unpause") { unpause(interaction) return } if (subcommand === "leave") { leave(interaction) return } } } as ICommand