2024-08-17 18:05:36 -04:00
|
|
|
const { getQueue, removeFromQueue } = require('../utils/queueManager');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
name: 'remove',
|
|
|
|
description: 'Remove a specific song from the queue by its number',
|
2024-08-17 20:13:09 -04:00
|
|
|
aliases: ['rm'],
|
2024-08-17 18:05:36 -04:00
|
|
|
execute(message, args) {
|
|
|
|
const queue = getQueue(message.guild.id);
|
|
|
|
const indexToRemove = parseInt(args[0], 10) - 1;
|
|
|
|
|
|
|
|
if (isNaN(indexToRemove) || indexToRemove < 0 || indexToRemove >= queue.length) {
|
|
|
|
return message.reply('Please provide a valid song number to remove.');
|
|
|
|
}
|
|
|
|
|
|
|
|
const removedTrack = removeFromQueue(message.guild.id, indexToRemove);
|
|
|
|
|
|
|
|
if (removedTrack) {
|
|
|
|
message.reply(`Removed **${removedTrack.title}** from the queue.`);
|
|
|
|
} else {
|
|
|
|
message.reply('There was an issue removing the song from the queue.');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|