aboutsummaryrefslogtreecommitdiff
path: root/src/listeners
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-07 10:27:08 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-07 10:27:08 -0400
commit198aeadfc73642498afcb1eb637e0de86ccc9308 (patch)
tree0509a12e3540330922bbfe037a7cc47c50f89f5f /src/listeners
parenteb0ac7cac5a08cd47f65e60c5a65bef23195810b (diff)
downloadtanzanite-198aeadfc73642498afcb1eb637e0de86ccc9308.tar.gz
tanzanite-198aeadfc73642498afcb1eb637e0de86ccc9308.tar.bz2
tanzanite-198aeadfc73642498afcb1eb637e0de86ccc9308.zip
better console eval
Diffstat (limited to 'src/listeners')
-rw-r--r--src/listeners/other/consoleListener.ts16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/listeners/other/consoleListener.ts b/src/listeners/other/consoleListener.ts
index ef43726..0954fb4 100644
--- a/src/listeners/other/consoleListener.ts
+++ b/src/listeners/other/consoleListener.ts
@@ -36,10 +36,20 @@ export default class ConsoleListener extends BushListener {
} = await import('discord.js');
/* eslint-enable @typescript-eslint/no-unused-vars */
try {
+ const depth = /--depth (?<depth>\d+)/.exec(line)?.groups?.depth ?? undefined;
+ const hidden = /--hidden/.test(line);
+ if (depth) line = line.replace(/--depth \d+/, '');
+ if (hidden) line = line.replace(/--hidden/, '');
const input = line.replace('eval ', '').replace('ev ', '');
- let output = eval(input);
- output = await output;
- console.log(output);
+ const output = await eval(input);
+ console.dir(output, {
+ colors: true,
+ getters: true,
+ maxArrayLength: Infinity,
+ maxStringLength: Infinity,
+ depth: depth ?? 2,
+ hidden: hidden
+ });
} catch (e) {
console.error(e);
}