Add audio queue
This commit is contained in:
4
index.js
4
index.js
@@ -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) => {
|
||||
|
Reference in New Issue
Block a user