Add audio queue

This commit is contained in:
2021-04-09 13:23:13 +02:00
parent 1fe978eec6
commit 75dc0c2da2
5 changed files with 33 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ async function initDB() {
const api = {
db: undefined,
queue: undefined,
ttsEngines: (() => {
let engines = {};
console.log(`Registering TTS engines...`);
@@ -77,9 +78,8 @@ const api = {
},
speak: async (channel, message, engine = api.announcementEngine, voice = api.announcementVoice, params = {}) => {
const conn = api.getConnectionForVoiceChannel(channel);
const filepath = await api.generateVoice(message, engine, voice, params);
if (conn) conn.play(filepath);
api.queue.add(filepath);
},
registerCommand: async (commandString, commandFunc) => {