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

module.exports = class PsychoVoice extends Command {
    constructor(client) {
        super(client, {
            name: 'psycho',
            group: 'voice',
            memberName: 'psycho',
            description: 'plays the psycho by mase',
            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=fnd_HSmAODs', {
                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');
        }
    }
};