This commit is contained in:
Supositware 2019-01-18 22:13:06 +01:00
parent f1a03f9b7d
commit 0bc7686733

View file

@ -57,11 +57,9 @@ class TtsvcCommand extends Command {
console.log('Audio content written to file: ttsvc.mp3'); console.log('Audio content written to file: ttsvc.mp3');
// If not in voice channel ask user to join // If not in voice channel ask user to join
if (!voiceChannel) {
return message.reply('please join a voice channel first!');
} else { // you should be careful in what is included in your scopes, you didn't use the {} if (message.member.voice.channel) {
// If user say "stop" make the bot leave voice channel const connection = await message.member.voice.channel.join();
if (text == 'stop') { if (text == 'stop') {
voiceChannel.leave(); voiceChannel.leave();
message.channel.send('I leaved the channel'); message.channel.send('I leaved the channel');
@ -74,6 +72,8 @@ class TtsvcCommand extends Command {
}, 2000)); }, 2000));
}); });
} }
} else {
message.reply('You need to join a voice channel first!');
} }
}); });
}); });