This commit is contained in:
Loïc Bersier 2018-09-08 00:39:41 +02:00
parent d9f33d3368
commit d34c2d7a19

View file

@ -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());
}); });