Simp-O-Matic

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

commit 400440e00ec488b5010bafcf09267faf6224cb0e
parent ffbaa763d5f73e996c07f1e36853d413b4d51cf9
Author: Demonstrandum <moi@knutsen.co>
Date:   Fri, 20 Mar 2020 00:16:37 +0000

Get output can be large.

Diffstat:
Mlib/main.ts | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/main.ts b/lib/main.ts @@ -190,9 +190,11 @@ export class SimpOMatic { const accessors = args[0].trim().split('.').squeeze(); const resolution = JSON.stringify( recursive_regex_to_string( - deep_copy(access(CONFIG, accessors)))); - - message.channel.send(` ⇒ \`${resolution}\``); + deep_copy(access(CONFIG, accessors))), null, 4); + const msgs = glue_strings((' ⇒ \n```\n' + resolution + '\n```') + .split('\n')) + for (const msg of msgs) + message.channel.send(msg); } catch (e) { message.channel.send(`Invalid object access-path\n` + `Problem: \`\`\`\n${e}\n\`\`\``); @@ -208,7 +210,7 @@ export class SimpOMatic { const parent = accessors.pop(); const obj = access(CONFIG, accessors); obj[parent] = JSON.parse(args[1]); - const normal = JSON.stringify(obj[parent]); + const normal = JSON.stringify(obj[parent], null, 4); message.channel.send(`Assignment successful. \`${args[0].trim()} = ${normal}\``.squeeze());