forked from Supositware/Haha-Yes
please work
This commit is contained in:
parent
bee00ef40e
commit
a4f2532700
1 changed files with 3 additions and 8 deletions
|
@ -44,7 +44,7 @@ class TtsvcCommand extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the binary audio content to a local file
|
// Write the binary audio content to a local file
|
||||||
fs.writeFile('ttsvc.mp3', response.audioContent, 'binary', err => {
|
fs.writeFile('ttsvc.mp3', response.audioContent, 'binary', async err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error('ERROR:', err);
|
console.error('ERROR:', err);
|
||||||
message.channel.send('An error has occured, the message is probably too long');
|
message.channel.send('An error has occured, the message is probably too long');
|
||||||
|
@ -53,15 +53,10 @@ 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 (message.member.voice.channel) {
|
if (message.member.voice.channel) {
|
||||||
const connection = message.member.voice.channel.join();
|
const connection = await message.member.voice.channel.join();
|
||||||
const dispatcher = connection.play('./ttsvc');
|
connection.play('./ttsvc');
|
||||||
|
|
||||||
dispatcher.on('finish', () => {
|
|
||||||
connection.leave();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
message.reply('You need to join a voice channel first!');
|
message.reply('You need to join a voice channel first!');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue