This commit is contained in:
parent
d9f33d3368
commit
d34c2d7a19
1 changed files with 4 additions and 3 deletions
|
@ -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!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ytblink == 'stop') {
|
||||||
|
voiceChannel.leave()
|
||||||
|
} else
|
||||||
voiceChannel.join().then(connection => {
|
voiceChannel.join().then(connection => {
|
||||||
const stream = ytdl(ytblink, { filter: 'audioonly' });
|
const stream = ytdl(ytblink, { filter: 'audioonly' });
|
||||||
const dispatcher = connection.playStream(stream);
|
const dispatcher = connection.playStream(stream);
|
||||||
|
|
||||||
if (ytblink == 'stop') {
|
|
||||||
voiceChannel.leave()
|
|
||||||
} else
|
|
||||||
|
|
||||||
dispatcher.on('end', () => voiceChannel.leave());
|
dispatcher.on('end', () => voiceChannel.leave());
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue