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

module.exports = class ABeeVoice extends Command {
    constructor(client) {
        super(client, {
            name: 'abee',
            aliases: ['a-bee'],
            group: 'voice',
            memberName: 'abee',
            description: 'a bee :D 🐝',
            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=lvdnhWhQBdo', {
                filter: 'audioonly'
            });
            const dispatcher = connection.play(stream);

            dispatcher.on('finish', () => {
                connection.disconnect();
            });
        } 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');
        }
    }
};