added comment
This commit is contained in:
parent
c4331ef249
commit
c47c95eaf6
1 changed files with 3 additions and 2 deletions
|
@ -20,11 +20,12 @@ module.exports = class MusicCommand extends Command {
|
|||
async run(message, { ytblink }) {
|
||||
const { voiceChannel } = message.member;
|
||||
|
||||
// If not in voice channel ask user to join
|
||||
if (!voiceChannel) {
|
||||
return message.reply('please join a voice channel first!');
|
||||
|
||||
} else
|
||||
|
||||
// If user say "stop" make the bot leave voice channel
|
||||
if (ytblink == 'stop') {
|
||||
voiceChannel.leave()
|
||||
} else
|
||||
|
@ -32,7 +33,7 @@ module.exports = class MusicCommand extends Command {
|
|||
const stream = ytdl(ytblink, { filter: 'audioonly' });
|
||||
const dispatcher = connection.playStream(stream);
|
||||
|
||||
|
||||
// End at then end of the audio stream
|
||||
dispatcher.on('end', () => voiceChannel.leave());
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue