aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord-akairo/BushClientUtil.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-05 18:48:38 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-05 18:48:38 -0400
commit2d66c896b9ab7fac426061fccd6ffa413242bc6a (patch)
tree0315533b233d9f3f74615c8959a621e54b8747b6 /src/lib/extensions/discord-akairo/BushClientUtil.ts
parentf4ed3141722719f26ac2286d57a92b1031accaf3 (diff)
downloadtanzanite-2d66c896b9ab7fac426061fccd6ffa413242bc6a.tar.gz
tanzanite-2d66c896b9ab7fac426061fccd6ffa413242bc6a.tar.bz2
tanzanite-2d66c896b9ab7fac426061fccd6ffa413242bc6a.zip
remove explicit any and add error for code block
Diffstat (limited to 'src/lib/extensions/discord-akairo/BushClientUtil.ts')
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index d8705a3..aa35edb 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -1,4 +1,3 @@
-/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import {
@@ -462,7 +461,13 @@ export class BushClientUtil extends ClientUtil {
if (code.length + formattingLength >= length) hasteOut = 'Too large to display. Hastebin: ' + (await this.haste(code));
const code2 = hasteOut ? code.substring(0, length - (hasteOut.length + '\n'.length + formattingLength)) : code;
- return tildes + language + '\n' + code2 + '\n' + tildes + (hasteOut.length ? '\n' + hasteOut : '');
+ const code3 = tildes + language + '\n' + code2 + '\n' + tildes + (hasteOut.length ? '\n' + hasteOut : '');
+ if (code3.length > length) {
+ void console.warn(`codeblockError`, `Required Length: ${length}. Actual Length: ${code3.length}`);
+ void console.warn(`codeblockError`, code3);
+ throw new Error('I fucked up');
+ }
+ return code3;
}
#mapCredential(old: string): string {
@@ -492,11 +497,11 @@ export class BushClientUtil extends ClientUtil {
return text;
}
- public async inspectCleanRedactCodeblock(input: any, language: 'ts' | 'js', inspectOptions?: InspectOptions) {
+ public async inspectCleanRedactCodeblock(input: any, language: 'ts' | 'js', inspectOptions?: InspectOptions, length = 1024) {
input = typeof input !== 'string' && inspectOptions !== undefined ? inspect(input, inspectOptions) : input;
input = Util.cleanCodeBlockContent(input);
input = this.redact(input);
- return client.util.codeblock(input, 1024, language);
+ return client.util.codeblock(input, length, language);
}
public async slashRespond(