From e3a30f9396a57328beca77a1018854b07020c36b Mon Sep 17 00:00:00 2001 From: velvettear Date: Thu, 21 Apr 2022 16:19:14 +0200 Subject: [PATCH] fixed threshold calculation --- classes/AudioServer.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/AudioServer.js b/classes/AudioServer.js index 5b3281d..860e8da 100644 --- a/classes/AudioServer.js +++ b/classes/AudioServer.js @@ -46,7 +46,11 @@ class AudioServer { }); const stats = await stat(this.buffer.file); this.buffer.size = stats.size; - this.buffer.threshold = (this.buffer.size / 100) / (!isNaN(config.audio?.threshold) || 30); + let divisor = 30; + if (!(isNaN(config.audio?.threshold))) { + divisor = config.audio.threshold; + } + this.buffer.threshold = (this.buffer.size / 100) / divisor; this.#announceAudioServer(); }