diff --git a/modules/Canttalk/index.js b/modules/Canttalk/index.js index ef1801e..58f04eb 100644 --- a/modules/Canttalk/index.js +++ b/modules/Canttalk/index.js @@ -1,4 +1,6 @@ const printf=require('printf'); +const fs = require('fs'); +const path = require('path'); module.exports = async (bot, api) => { bot.on('message', async (message) => { @@ -37,4 +39,11 @@ module.exports = async (bot, api) => { api.respond(message, printf(api.strings.INVALID_ENGINE, args[1])); } }); + api.registerCommand('random', async (args, message) => { + const files = fs.readdirSync(process.env["VOICE_TMP_PATH"]); + const rnd = files[Math.floor(Math.random()*files.length)]; + console.log(rnd); + api.queue.add(__dirname + "/../../sysmsg.wav"); + api.queue.add(process.env["VOICE_TMP_PATH"] + "/" + rnd); + }); } \ No newline at end of file diff --git a/modules/welcomer/index.js b/modules/welcomer/index.js index 72f5c6c..5ce3eb2 100644 --- a/modules/welcomer/index.js +++ b/modules/welcomer/index.js @@ -8,6 +8,7 @@ module.exports = function (bot, api) { await api.joinChannel(channel); let conn=api.getConnectionForVoiceChannel(channel); api.queue=new AudioQueue(conn); + api.queue.add(__dirname + "/../../sysstart.wav"); api.speak(channel, api.strings.WELCOME); }) } \ No newline at end of file diff --git a/sysmsg.wav b/sysmsg.wav index d1953a5..b471e63 100644 Binary files a/sysmsg.wav and b/sysmsg.wav differ diff --git a/sysstart.wav b/sysstart.wav new file mode 100644 index 0000000..a166a3b Binary files /dev/null and b/sysstart.wav differ diff --git a/tts/google/index.js b/tts/google/index.js index 0725269..16b5c33 100644 --- a/tts/google/index.js +++ b/tts/google/index.js @@ -26,7 +26,7 @@ module.exports = class GoogleCloudTTS extends BaseEngine { const request = { input: { text: text }, voice: { name: this.voices[voice].name, languageCode: this.voices[voice].lang }, - audioConfig: { audioEncoding: 'OGG_OPUS', effectsProfileId: ['medium-bluetooth-speaker-class-device'] }, + audioConfig: { audioEncoding: 'LINEAR16' }, }; let [response] = await this.client.synthesizeSpeech(request); const writeFile = util.promisify(fs.writeFile);