@getsolara/solara.voice
Version:
Optional voice functionality for @getsolara/solara.js using @discordjs/voice
19 lines • 1.25 kB
JavaScript
module.exports = {
name: "$voiceQueueRemove",
description: "Removes a song from the queue by index (1-based). Args: index",
takesBrackets: true,
execute: async (context, args) => {
if (context.client.voiceInitialized === false) {
return "[Error: $voiceQueueRemove requires voice features to be enabled. Ensure @getsolara/solara.voice is installed and configured correctly.]";
}
if (!context.guild) return "[Error: $voiceQueueRemove can only be used in a server.]";
if (!args[0]) return "[Error: $voiceQueueRemove requires a queue index (1-based)]";
const index = parseInt(args[0], 10);
if (isNaN(index) || index < 1) return "[Error: Invalid index for $voiceQueueRemove. Must be a positive number.]";
const queue = context.client.solaraVoiceQueues?.get(context.guild.id);
if (!queue || queue.length === 0) return "[Error: Queue is empty or bot not connected for $voiceQueueRemove.]";
if (index > queue.length) return `[Error: Index out of bounds for $voiceQueueRemove (Queue size: ${queue.length})]`;
const removed = queue.splice(index - 1, 1);
return `Removed: **${removed[0]?.title || 'Unknown Track'}**`;
}
};