Simp-O-Matic

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

commit 19fe771ffab58262acfa08e6535830f41b8f3886
parent 3c2acdaa01a935b244f66c7fd81a6cb736ba6333
Author: Demonstrandum <moi@knutsen.co>
Date:   Sun, 22 Mar 2020 21:23:04 +0000

!export should export the global config.

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

diff --git a/lib/main.ts b/lib/main.ts @@ -395,9 +395,9 @@ export class SimpOMatic { }); break; } case 'export': { - let export_string = export_config(CONFIG, {}); + let export_string = export_config(GLOBAL_CONFIG, {}); if (export_string.length > 1980) { - export_string = export_config(CONFIG, { ugly: true }); + export_string = export_config(GLOBAL_CONFIG, { ugly: true }); } const today = (new Date()) @@ -409,8 +409,8 @@ export class SimpOMatic { const file_name = `export-${today}.json`; const file_dest = `${process.cwd()}/${file_name}`; - write_file(file_dest, export_config(CONFIG, {})); - pastebin_update(export_config(CONFIG, {})); + write_file(file_dest, export_config(GLOBAL_CONFIG, {})); + pastebin_update(export_config(GLOBAL_CONFIG, {})); if (export_string.length < 1980) { message.channel.send("```json\n" + export_string + "\n```"); diff --git a/lib/utils.ts b/lib/utils.ts @@ -93,8 +93,8 @@ export const recursive_regex_to_string = o => { return o; }; -export const export_config = (obj, { ugly = false }) => { - const o = recursive_regex_to_string(deep_clone(obj)); +export const export_config = (obj: GlobalConfigType, { ugly = false }) => { + const o: GlobalConfigType = recursive_regex_to_string(deep_clone(obj)); // Make sure all rules are unique, // i.e. eliminate duplicate rules.