2024-08-17 19:16:40 -04:00
|
|
|
const { skipTrack, getCurrentTrack, getQueue } = require('../utils/queueManager');
|
2024-08-17 11:11:10 -04:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
name: 'skip',
|
2024-08-17 15:20:51 -04:00
|
|
|
description: 'Skip the current track',
|
2024-08-17 11:11:10 -04:00
|
|
|
execute(message) {
|
2024-08-17 11:23:30 -04:00
|
|
|
const guildId = message.guild.id;
|
2024-08-17 11:46:19 -04:00
|
|
|
const voiceChannel = message.member.voice.channel;
|
2024-08-17 11:23:30 -04:00
|
|
|
|
2024-08-17 11:46:19 -04:00
|
|
|
if (!voiceChannel) {
|
|
|
|
return message.reply('You need to be in a voice channel to skip music!');
|
2024-08-17 11:23:30 -04:00
|
|
|
}
|
2024-08-17 11:46:19 -04:00
|
|
|
|
2024-08-17 19:16:40 -04:00
|
|
|
const currentTrack = getCurrentTrack(guildId);
|
|
|
|
const queue = getQueue(guildId);
|
|
|
|
|
|
|
|
if (!currentTrack && queue.length === 0) {
|
|
|
|
return message.reply('There is no track currently playing or in the queue to skip!');
|
|
|
|
}
|
|
|
|
|
2024-08-17 14:58:17 -04:00
|
|
|
skipTrack(guildId, voiceChannel);
|
2024-08-17 11:46:19 -04:00
|
|
|
message.channel.send('Skipped the current track!');
|
2024-08-17 11:11:10 -04:00
|
|
|
}
|
2024-08-17 11:23:30 -04:00
|
|
|
};
|