DZ-Musicbot/commands/skip.js

25 lines
802 B
JavaScript

const { skipTrack, getCurrentTrack, getQueue } = require('../utils/queueManager');
module.exports = {
name: 'skip',
description: 'Skip the current track',
aliases: ['s'],
execute(message) {
const guildId = message.guild.id;
const voiceChannel = message.member.voice.channel;
if (!voiceChannel) {
return message.reply('You need to be in a voice channel to skip music!');
}
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!');
}
skipTrack(guildId, voiceChannel);
message.channel.send('Skipped the current track!');
}
};