Removed "leaved" and made thing a little better

This commit is contained in:
Supositware 2019-04-06 21:05:46 +02:00
parent e077f6ccba
commit afaa91330a

View file

@ -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');
});
}); });
} }
} }