summaryrefslogtreecommitdiff
path: root/commands/psycho.js
blob: 13bca985b0913aa56649a52e8a12b3893996a112 (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
const ytdl = require('ytdl-core');
const voice_check_dialog = require('../utils/voice_check_dialog.js');

module.exports = {
    name: 'psycho',
    description: '',
    async execute(msg, args, bot) {
        if (msg.member.voiceChannel && !msg.guild.voiceConnection) {
            const connection = await msg.member.voiceChannel.join();
            const stream = ytdl('https://www.youtube.com/watch?v=fnd_HSmAODs', {
                filter: 'audioonly'
            });
            const dispatcher = connection.playStream(stream, {
                volume: 0.5
            });

            dispatcher.on('end', () => {
                msg.member.voiceChannel.leave();
            });
        } else {
            voice_check_dialog.execute(msg);
        }
    }
};