Simp-O-Matic

Dumb Discord bot in TS.
git clone git://git.knutsen.co/Simp-O-Matic
Log | Files | Refs | README | LICENSE

commit 90023f73806af37fa15e2347e29fe22a07ad2069
parent 6225aeb4fba19d8d3ce1000cd2846e106514d57c
Author: Demonstrandum <moi@knutsen.co>
Date:   Wed, 11 Nov 2020 01:17:19 +0000

Fix infinite recursion issues.

Diffstat:
Mlib/extensions.ts | 6+++---
Mlib/main.ts | 4++++
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/extensions.ts b/lib/extensions.ts @@ -164,13 +164,13 @@ declare global { // JSON Extensions: JSON.dump = function (object, replacer=null, space=4) { const DEFAULT_REPLACER = replacer = (key, value) => { - if (key === 'vc') return null; + if (key === 'vc' || key === 'vcc' + || key === 'vcqueue' || key === 'vcdispatcher') + return null; return value; }; if (replacer === null) replacer = DEFAULT_REPLACER; - else replacer = (key, value) => - replacer(key, DEFAULT_REPLACER(key, value)); return JSON.stringify(object, replacer, space); } diff --git a/lib/main.ts b/lib/main.ts @@ -623,7 +623,11 @@ Would you like to slow down a little?`.squeeze()); let CLIENT: Client = null; +let term_count = 0; + function on_termination(error_type, e?: Error) { + if (term_count > 15) return; + term_count += 1; // Back-up the resultant CONFIG to an external file. console.warn(`Received ${error_type}, shutting down.`); if (e) console.warn(e);