Updated description

This commit is contained in:
Loïc Bersier 2018-09-08 22:30:50 +02:00
parent c092aacda2
commit 557fb214ca

View file

@ -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 => {
const stream = ytdl(ytblink, { filter: 'audioonly' });
const dispatcher = connection.playStream(stream);
dispatcher.on('end', () => voiceChannel.leave());
});
} }
if (ytblink == 'stop') {
voiceChannel.leave()
} else
voiceChannel.join().then(connection => {
const stream = ytdl(ytblink, { filter: 'audioonly' });
const dispatcher = connection.playStream(stream);
dispatcher.on('end', () => voiceChannel.leave());
});
} }
}; };