Merge branch 'master' of https://code.iamtalon.me/talon/tardis-bot
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
const printf=require('printf');
|
const printf=require('printf');
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = async (bot, api) => {
|
module.exports = async (bot, api) => {
|
||||||
bot.on('message', async (message) => {
|
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.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);
|
||||||
|
});
|
||||||
}
|
}
|
@@ -8,6 +8,7 @@ module.exports = function (bot, api) {
|
|||||||
await api.joinChannel(channel);
|
await api.joinChannel(channel);
|
||||||
let conn=api.getConnectionForVoiceChannel(channel);
|
let conn=api.getConnectionForVoiceChannel(channel);
|
||||||
api.queue=new AudioQueue(conn);
|
api.queue=new AudioQueue(conn);
|
||||||
|
api.queue.add(__dirname + "/../../sysstart.wav");
|
||||||
api.speak(channel, api.strings.WELCOME);
|
api.speak(channel, api.strings.WELCOME);
|
||||||
})
|
})
|
||||||
}
|
}
|
BIN
sysmsg.wav
BIN
sysmsg.wav
Binary file not shown.
BIN
sysstart.wav
Normal file
BIN
sysstart.wav
Normal file
Binary file not shown.
@@ -26,7 +26,7 @@ module.exports = class GoogleCloudTTS extends BaseEngine {
|
|||||||
const request = {
|
const request = {
|
||||||
input: { text: text },
|
input: { text: text },
|
||||||
voice: { name: this.voices[voice].name, languageCode: this.voices[voice].lang },
|
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);
|
let [response] = await this.client.synthesizeSpeech(request);
|
||||||
const writeFile = util.promisify(fs.writeFile);
|
const writeFile = util.promisify(fs.writeFile);
|
||||||
|
Reference in New Issue
Block a user