diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-11-22 19:01:46 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-11-22 19:01:46 -0500 |
commit | fce1fc87feb3e6dad1a956d757d856833c9ea5f6 (patch) | |
tree | 723ca41af60df525b89c6ff5b4e9574f78235734 /src/lib/extensions/discord-akairo/BushClientUtil.ts | |
parent | 23bf2485fe17472f17bd0ee0af6b22973e317550 (diff) | |
download | tanzanite-fce1fc87feb3e6dad1a956d757d856833c9ea5f6.tar.gz tanzanite-fce1fc87feb3e6dad1a956d757d856833c9ea5f6.tar.bz2 tanzanite-fce1fc87feb3e6dad1a956d757d856833c9ea5f6.zip |
update contributors, fix formatting, added a bunch of repo forks
Diffstat (limited to 'src/lib/extensions/discord-akairo/BushClientUtil.ts')
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClientUtil.ts | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index f21d104..8f1e67a 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -16,6 +16,7 @@ import { type Pronoun, type PronounCode } from '#lib'; +import { humanizeDuration } from '@notenoughupdates/humanize-duration'; import { exec } from 'child_process'; import { ClientUtil, Util as AkairoUtil } from 'discord-akairo'; import { APIMessage } from 'discord-api-types'; @@ -40,7 +41,6 @@ import moment from 'moment'; import { inspect, promisify } from 'util'; import CommandErrorListener from '../../../listeners/commands/commandError.js'; import { Format } from '../../common/Format.js'; -const { default: humanizeDuration } = await import ('humanize-duration') export class BushClientUtil extends ClientUtil { /** @@ -255,11 +255,11 @@ 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) + const optionsWithDefaults = this.getDefaultInspectOptions(options); return inspect(object, optionsWithDefaults); } - private getDefaultInspectOptions(options?:BushInspectOptions): BushInspectOptions { + private getDefaultInspectOptions(options?: BushInspectOptions): BushInspectOptions { const { showHidden = false, depth = 2, @@ -274,18 +274,18 @@ export class BushClientUtil extends ClientUtil { getters = true } = options ?? {}; return { - showHidden, - depth, - colors, - customInspect, - showProxy, - maxArrayLength, - maxStringLength, - breakLength, - compact, - sorted, + showHidden, + depth, + colors, + customInspect, + showProxy, + maxArrayLength, + maxStringLength, + breakLength, + compact, + sorted, getters - } + }; } #mapCredential(old: string): string { @@ -331,9 +331,7 @@ export class BushClientUtil extends ClientUtil { length = 1024 ) { input = - !inspectOptions?.inspectStrings && typeof input === 'string' - ? input - : this.inspect(input, inspectOptions ?? undefined); + !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); @@ -449,8 +447,8 @@ export class BushClientUtil extends ClientUtil { } public humanizeDuration(duration: number, largest?: number): string { - if (largest) return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2, largest }); - else return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2 }); + if (largest) return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2, largest })!; + else return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2 })!; } public timestampDuration(duration: number): string { |