aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord-akairo
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
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')
-rw-r--r--src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts1
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts13
-rw-r--r--src/lib/extensions/discord-akairo/BushCommand.ts1
-rw-r--r--src/lib/extensions/discord-akairo/BushCommandHandler.ts1
-rw-r--r--src/lib/extensions/discord-akairo/BushInhibitor.ts1
5 files changed, 9 insertions, 8 deletions
diff --git a/src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts b/src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts
index 9afcf8b..42d989c 100644
--- a/src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts
+++ b/src/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts
@@ -1,4 +1,3 @@
-/* eslint-disable @typescript-eslint/no-explicit-any */
import { BushMessage } from '../discord.js/BushMessage';
export type BushArgumentTypeCaster = (message: BushMessage, phrase: string) => any;
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(
diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts
index 6dd5449..0266b1d 100644
--- a/src/lib/extensions/discord-akairo/BushCommand.ts
+++ b/src/lib/extensions/discord-akairo/BushCommand.ts
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
-/* eslint-disable @typescript-eslint/no-explicit-any */
import { ArgumentOptions, ArgumentPromptOptions, ArgumentTypeCaster, Command, CommandOptions } from 'discord-akairo';
import { Snowflake } from 'discord.js';
import { BushMessage } from '../discord.js/BushMessage';
diff --git a/src/lib/extensions/discord-akairo/BushCommandHandler.ts b/src/lib/extensions/discord-akairo/BushCommandHandler.ts
index 7eca05b..cf49f4f 100644
--- a/src/lib/extensions/discord-akairo/BushCommandHandler.ts
+++ b/src/lib/extensions/discord-akairo/BushCommandHandler.ts
@@ -1,4 +1,3 @@
-/* eslint-disable @typescript-eslint/no-explicit-any */
import { Category, CommandHandler, CommandHandlerEvents, CommandHandlerOptions } from 'discord-akairo';
import { Collection, PermissionString } from 'discord.js';
import { BushConstants } from '../../utils/BushConstants';
diff --git a/src/lib/extensions/discord-akairo/BushInhibitor.ts b/src/lib/extensions/discord-akairo/BushInhibitor.ts
index 8a199fc..d689a72 100644
--- a/src/lib/extensions/discord-akairo/BushInhibitor.ts
+++ b/src/lib/extensions/discord-akairo/BushInhibitor.ts
@@ -1,4 +1,3 @@
-/* eslint-disable @typescript-eslint/no-explicit-any */
import { Inhibitor } from 'discord-akairo';
import { BushMessage } from '../discord.js/BushMessage';
import { BushClient } from './BushClient';