1
0
Fork 0

Updated description

Commando
Loïc Bersier 6 years ago
parent c092aacda2
commit 557fb214ca

@ -19,20 +19,20 @@ module.exports = class MusicCommand extends Command {
run(message, { ytblink }) { run(message, { ytblink }) {
const { voiceChannel } = message.member; const { voiceChannel } = message.member;
if (!voiceChannel) {
return message.reply('please join a voice channel first!');
}
if (!voiceChannel) { if (ytblink == 'stop') {
return message.reply('please join a voice channel first!'); voiceChannel.leave()
} } else
voiceChannel.join().then(connection => {
if (ytblink == 'stop') { const stream = ytdl(ytblink, { filter: 'audioonly' });
voiceChannel.leave() const dispatcher = connection.playStream(stream);
} 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