|
|
@ -62,12 +62,14 @@ class TtsvcCommand extends Command {
|
|
|
|
// If user say "stop" make the bot leave voice channel
|
|
|
|
// If user say "stop" make the bot leave voice channel
|
|
|
|
if (text == 'stop') {
|
|
|
|
if (text == 'stop') {
|
|
|
|
voiceChannel.leave();
|
|
|
|
voiceChannel.leave();
|
|
|
|
message.channel.send('I left the channel');
|
|
|
|
message.channel.send('I leaved the channel');
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
voiceChannel.join().then(connection => {
|
|
|
|
voiceChannel.join().then(connection => {
|
|
|
|
const dispatcher = connection.playStream('./ttsvc.mp3');
|
|
|
|
const dispatcher = connection.playStream('./ttsvc.mp3');
|
|
|
|
// End at then end of the audio stream
|
|
|
|
// End at then end of the audio stream
|
|
|
|
dispatcher.on('end', () => voiceChannel.leave())
|
|
|
|
dispatcher.on('end', () => setTimeout(function(){
|
|
|
|
|
|
|
|
voiceChannel.leave();
|
|
|
|
|
|
|
|
}, 2000));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|