UNPKG

@getsolara/solara.voice

Version:

Optional voice functionality for @getsolara/solara.js using @discordjs/voice

28 lines (26 loc) 1.39 kB
module.exports = { name: "$voiceSkip", description: "Skips the current song and plays the next in queue.", takesBrackets: false, execute: async (context, args) => { if (context.client.voiceInitialized === false) { return "[Error: $voiceSkip requires voice features to be enabled. Ensure @getsolara/solara.voice is installed and configured correctly.]"; } if (!context.guild) return "[Error: $voiceSkip can only be used in a server.]"; const guildId = context.guild.id; const player = context.client.solaraAudioPlayers?.get(guildId); const queue = context.client.solaraVoiceQueues?.get(guildId); if (!player || player.state.status === 'idle' && (!queue || queue.length === 0) ) { return "[Error: Nothing to skip or queue is empty.]"; } const currentTrack = context.client.solaraNowPlaying?.get(guildId); player.stop(true); // playNextTrackInQueue will be triggered by the 'idle' state of the player // but we can give immediate feedback. if (queue && queue.length > 0) { return `Skipped **${currentTrack?.title || 'current song'}**. Next up: **${queue[0].title}**.`; } else { return `Skipped **${currentTrack?.title || 'current song'}**. Queue is now empty.`; } } };