1
0
Fork 0
Loïc Bersier 6 years ago
parent d9f33d3368
commit d34c2d7a19

@ -23,13 +23,14 @@ module.exports = class MusicCommand extends Command {
if (!voiceChannel) { if (!voiceChannel) {
return message.reply('please join a voice channel first!'); return message.reply('please join a voice channel first!');
} }
voiceChannel.join().then(connection => {
const stream = ytdl(ytblink, { filter: 'audioonly' });
const dispatcher = connection.playStream(stream);
if (ytblink == 'stop') { if (ytblink == 'stop') {
voiceChannel.leave() voiceChannel.leave()
} else } else
voiceChannel.join().then(connection => {
const stream = ytdl(ytblink, { filter: 'audioonly' });
const dispatcher = connection.playStream(stream);
dispatcher.on('end', () => voiceChannel.leave()); dispatcher.on('end', () => voiceChannel.leave());
}); });

Loading…
Cancel
Save