Removed "leaved" and made thing a little better
This commit is contained in:
parent
e077f6ccba
commit
afaa91330a
1 changed files with 6 additions and 3 deletions
|
@ -33,14 +33,17 @@ class playCommand extends Command {
|
||||||
// If user say "stop" make the bot leave voice channel
|
// If user say "stop" make the bot leave voice channel
|
||||||
if (args.ytblink == 'stop') {
|
if (args.ytblink == 'stop') {
|
||||||
voiceChannel.leave();
|
voiceChannel.leave();
|
||||||
message.channel.send('I leaved the channel');
|
return message.channel.send('I left the channel');
|
||||||
} else
|
} else
|
||||||
voiceChannel.join().then(connection => {
|
voiceChannel.join().then(connection => {
|
||||||
const stream = ytdl(args.ytblink, { filter: 'audioonly' });
|
const stream = ytdl(args.ytblink, { filter: 'audioonly' });
|
||||||
const dispatcher = connection.play(stream);
|
const dispatcher = connection.play(stream);
|
||||||
|
message.channel.send('Playing it now!');
|
||||||
// End at then end of the audio stream
|
// End at then end of the audio stream
|
||||||
dispatcher.on('end', () => voiceChannel.leave());
|
dispatcher.on('end', () => {
|
||||||
message.channel.send('Music ended, Leaved the channel');
|
voiceChannel.leave();
|
||||||
|
return message.channel.send('Music ended, i left the channel');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue