summaryrefslogtreecommitdiff
path: root/commands/voice/itemshop.js
blob: c7b4825d7fef29181b083b9a839bfb21d2f4126a (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
const ytdl = require('ytdl-core');
const { Command } = require('discord.js-commando');
const emoji = require('emoji-random');

module.exports = class ItemShopVoice extends Command {
    constructor(client) {
        super(client, {
            name: 'itemstop',
            aliases: ['is'],
            group: 'voice',
            memberName: 'itemstop',
            description: 'use code frozen in the itemshop',
            guildOnly: true
        });
    }
    async run(msg) {
        if (msg.member.voice.channel && !msg.guild.voice) {
            const connection = await msg.member.voice.channel.join();
            const stream = ytdl('https://www.youtube.com/watch?v=pBiI1hTwU7E', {
                filter: 'audioonly'
            });
            const dispatcher = connection.play(stream);
            msg.reply('USE CODE FROZEN IN THE FORTNITE ITEM SHOP!!! ' + emoji.random());

            function timeCheck() {
                if (dispatcher.streamTime >= 6000) {
                    connection.disconnect();
                }
            }
            setInterval(timeCheck, 500);
        } else if (msg.guild.voice) {
            msg.reply('i\'m already playing that lol');
        } else {
            msg.reply('you need to join a voice channel first silly');
        }
    }
};