summaryrefslogtreecommitdiff
path: root/commands/voice/skipto.js
blob: 5c41e66b7fd0c41f2eff394374358f66deb07dc7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { Command } = require('discord.js-commando');

module.exports = class SkipToVoice extends Command {
    constructor(client) {
        super(client, {
            name: 'skipto',
            group: 'voice',
            memberName: 'skipto',
            description: 'skip to a certain song in da q >_<',
            guildOnly: true,
            args: [{
                key: 'songNumber',
                prompt: 'what song u want to skip 2 in da q ???',
                type: 'integer'
            }]
        });
    }
    run(msg, { songNumber }) {
        if (songNumber < 1 && songNumber >= msg.guild.musicData.queue.length) {
            return msg.reply('enter a valid song number dumb');
        }
        var voiceChannel = msg.member.voice.channel;
        if (!voiceChannel) return msg.reply('join channel and try again for cool');

        if (
            typeof msg.guild.musicData.songDispatcher == 'undefined' ||
            msg.guild.musicData.songDispatcher == null
        ) {
            return msg.reply('there is no song playing right now dumby');
        }

        if (msg.guild.musicData.queue < 1)
            return msg.reply('there are no songs in queue rn');

        msg.guild.musicData.queue.splice(0, songNumber - 1);
        msg.guild.musicData.songDispatcher.end();
        return;
    }
};