diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-11-15 21:21:14 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-11-15 21:21:14 -0500 |
commit | 23bf2485fe17472f17bd0ee0af6b22973e317550 (patch) | |
tree | a5ccf324db664d3a9a68938133c985698cfa1327 /src/lib/extensions | |
parent | b7783efab09b12fae190729f940ccfe6b4d4c7d9 (diff) | |
download | tanzanite-23bf2485fe17472f17bd0ee0af6b22973e317550.tar.gz tanzanite-23bf2485fe17472f17bd0ee0af6b22973e317550.tar.bz2 tanzanite-23bf2485fe17472f17bd0ee0af6b22973e317550.zip |
made javascript command probably a really bad idea
Diffstat (limited to 'src/lib/extensions')
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClientUtil.ts | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index 4b68b2e..f21d104 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -255,33 +255,37 @@ export class BushClientUtil extends ClientUtil { * @param options - The options you would like to use to inspect the object */ public inspect(object: any, options?: BushInspectOptions): string { + const optionsWithDefaults = this.getDefaultInspectOptions(options) + return inspect(object, optionsWithDefaults); + } + + private getDefaultInspectOptions(options?:BushInspectOptions): BushInspectOptions { const { - showHidden: _showHidden = false, - depth: _depth = 2, - colors: _colors = false, - customInspect: _customInspect = true, - showProxy: _showProxy = false, - maxArrayLength: _maxArrayLength = Infinity, - maxStringLength: _maxStringLength = Infinity, - breakLength: _breakLength = 80, - compact: _compact = 3, - sorted: _sorted = false, - getters: _getters = true + showHidden = false, + depth = 2, + colors = false, + customInspect = true, + showProxy = false, + maxArrayLength = Infinity, + maxStringLength = Infinity, + breakLength = 80, + compact = 3, + sorted = false, + getters = true } = options ?? {}; - const optionsWithDefaults: BushInspectOptions = { - showHidden: _showHidden, - depth: _depth, - colors: _colors, - customInspect: _customInspect, - showProxy: _showProxy, - maxArrayLength: _maxArrayLength, - maxStringLength: _maxStringLength, - breakLength: _breakLength, - compact: _compact, - sorted: _sorted, - getters: _getters - }; - return inspect(object, optionsWithDefaults); + return { + showHidden, + depth, + colors, + customInspect, + showProxy, + maxArrayLength, + maxStringLength, + breakLength, + compact, + sorted, + getters + } } #mapCredential(old: string): string { @@ -323,10 +327,14 @@ export class BushClientUtil extends ClientUtil { public async inspectCleanRedactCodeblock( input: any, language?: CodeBlockLang | '', - inspectOptions?: BushInspectOptions, + inspectOptions?: BushInspectOptions & { inspectStrings?: boolean }, length = 1024 ) { - input = typeof input !== 'string' ? this.inspect(input, inspectOptions ?? undefined) : input; + input = + !inspectOptions?.inspectStrings && typeof input === 'string' + ? input + : this.inspect(input, inspectOptions ?? undefined); + if (inspectOptions) inspectOptions.inspectStrings = undefined; input = this.discord.cleanCodeBlockContent(input); input = this.redact(input); return this.codeblock(input, length, language, true); |