From c6c370d22b70daac145bb15727c3c5ba8f3cf307 Mon Sep 17 00:00:00 2001 From: guilevi <guilevi2000@gmail.com> Date: Fri, 9 Apr 2021 16:21:31 +0200 Subject: [PATCH] Implement queue flush --- AudioQueue.js | 5 +++++ {tts/azure => azure}/index.js | 0 modules/ttsSettings/index.js | 1 + tts/.DS_Store | Bin 8196 -> 8196 bytes 4 files changed, 6 insertions(+) rename {tts/azure => azure}/index.js (100%) diff --git a/AudioQueue.js b/AudioQueue.js index 09771f7..970ee93 100644 --- a/AudioQueue.js +++ b/AudioQueue.js @@ -20,4 +20,9 @@ module.exports = class AudioQueue { this.queue.push(element); if (this.queue.length == 1) this.playNext(); } + flush() { + this.current.setVolume(0); + this.queue=[]; + this.playNext(); + } } \ No newline at end of file diff --git a/tts/azure/index.js b/azure/index.js similarity index 100% rename from tts/azure/index.js rename to azure/index.js diff --git a/modules/ttsSettings/index.js b/modules/ttsSettings/index.js index 5efcc10..7953a89 100644 --- a/modules/ttsSettings/index.js +++ b/modules/ttsSettings/index.js @@ -17,4 +17,5 @@ module.exports = function (bot, api) { api.respond(message, args[1] + " is not a valid engine name"); } }); + api.registerCommand('flush',()=>api.queue.flush()); } \ No newline at end of file diff --git a/tts/.DS_Store b/tts/.DS_Store index 6d587dd05bbfdf7ad9562fc2f485d068d55ea357..7477046a9e3fa9c865716e9bda7a86bf280d43e1 100644 GIT binary patch delta 80 zcmZp1XmQw}FTi+mvVlN@rbKnMk%gs>g0Z1xt&T#qrICS-f{C$NZ7nB<xT>M8XF_ge kRdr2m-OS0?1>_lLO_mpw*vv2Zjcqf##5b1BzeU)Y0m{l4-v9sr delta 30 mcmZp1XmQw}FEIIm;OWUKf})!R1;4RvW|jECviZLVJ2L>ZItvj1