aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json3
-rw-r--r--src/commands/dev/test.ts1
-rw-r--r--src/commands/utilities/uuid.ts1
-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
-rw-r--r--src/lib/extensions/discord.js/BushGuildMemberManager.d.ts1
-rw-r--r--src/lib/utils/BushLogger.ts1
-rw-r--r--src/listeners/commands/commandError.ts20
11 files changed, 18 insertions, 26 deletions
diff --git a/package.json b/package.json
index 879c69d..eb85a38 100644
--- a/package.json
+++ b/package.json
@@ -121,7 +121,8 @@
"@typescript-eslint/no-loss-of-precision": "error",
"no-throw-literal": "off",
"@typescript-eslint/no-throw-literal": "warn",
- "@typescript-eslint/prefer-nullish-coalescing": "warn"
+ "@typescript-eslint/prefer-nullish-coalescing": "warn",
+ "@typescript-eslint/no-explicit-any": "off"
}
},
"prettier": {
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index 5552803..60e93c4 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -1,4 +1,3 @@
-/* eslint-disable @typescript-eslint/no-explicit-any */
import { BushCommand, BushMessage } from '@lib';
import { Constants as jsConstants, MessageActionRow, MessageButton, MessageEmbed } from 'discord.js';
diff --git a/src/commands/utilities/uuid.ts b/src/commands/utilities/uuid.ts
index 06856d9..50280a0 100644
--- a/src/commands/utilities/uuid.ts
+++ b/src/commands/utilities/uuid.ts
@@ -28,7 +28,6 @@ export default class UuidCommand extends BushCommand {
});
}
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
public override async exec(message: BushMessage, { ign }: { ign: { match: any[]; matches: any[] } }): Promise<unknown> {
if (!ign) return await message.util.reply(`${util.emojis.error} Please enter a valid ign.`);
const readableIGN = ign.match[0];
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';
diff --git a/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts b/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts
index b3f2b1b..cd74fff 100644
--- a/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts
+++ b/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts
@@ -1,4 +1,3 @@
-/* eslint-disable @typescript-eslint/no-explicit-any */
import {
AddGuildMemberOptions,
BanOptions,
diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts
index cf5969c..27c8cd1 100644
--- a/src/lib/utils/BushLogger.ts
+++ b/src/lib/utils/BushLogger.ts
@@ -1,4 +1,3 @@
-/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import chalk from 'chalk';
import { MessageEmbed, Util } from 'discord.js';
diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts
index f7bd44d..e5de0cc 100644
--- a/src/listeners/commands/commandError.ts
+++ b/src/listeners/commands/commandError.ts
@@ -19,21 +19,19 @@ export default class CommandErrorListener extends BushListener {
const isSlash = message.util.isSlash;
const errorNo = Math.floor(Math.random() * 6969696969) + 69; // hehe funny number
+ const channel = message.channel.type === 'DM' ? message.channel.recipient.tag : message.channel.name;
const errorEmbed: MessageEmbed = new MessageEmbed()
.setTitle(`${isSlash ? 'Slash ' : ''}Error # \`${errorNo}\`: An error occurred`)
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
- .addField('Error', await util.codeblock(`${error?.stack || error}`, 1024, 'js'))
+ .addField('Error', await util.inspectCleanRedactCodeblock(error?.stack || error, 'js', undefined))
.setColor(util.colors.error)
.setTimestamp();
const description = [
`**User:** ${message.author} (${message.author.tag})`,
- `**Command:** ${command}`,
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
- `**Channel:** ${message.channel} (${message.channel?.id})`,
+ `**Command:** ${command ?? message?.util?.parsed?.command ?? 'N/A'}`,
+ `**Channel:** ${channel} (${message.channel?.id})`,
`**Message:** [link](${message.url})`
];
- // @ts-ignore: shut
- if (error?.code) description.push(`**Error Code:** \`${error.code}\``);
+ if ('code' in error) description.push(`**Error Code:** \`${(error as any).code}\``);
if (message?.util?.parsed?.content) description.push(`**Command Content:** ${message.util.parsed.content}`);
errorEmbed.setDescription(description.join('\n'));
await client.logger.channelError({ embeds: [errorEmbed] });
@@ -53,24 +51,20 @@ export default class CommandErrorListener extends BushListener {
}\`, an error occurred. Please give the developers code \`${errorNo}\`.`
);
(await message.util?.send({ embeds: [errorUserEmbed] }).catch((e) => {
- const channel = message.channel.type === 'DM' ? message.channel.recipient.tag : message.channel.name;
void client.console.warn(heading, `Failed to send user error embed in <<${channel}>>:\n` + e?.stack || e);
})) ?? client.console.error(heading, `Failed to send user error embed.` + error?.stack || error, false);
} else {
const errorDevEmbed = new MessageEmbed()
- // @ts-ignore: shut
- .setTitle(`A Command Error Occurred ${error?.code ? `\`${error.code}\`` : ''}`)
+ .setTitle(`A Command Error Occurred ${'code' in error ? `\`${(error as any).code}\`` : ''}`)
.setColor(util.colors.error)
.setTimestamp()
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
- .setDescription(await util.codeblock(`${error?.stack || error}`, 2048, 'js'));
+ .setDescription(await util.inspectCleanRedactCodeblock(error?.stack || error, 'js', undefined, 4096));
(await message.util?.send({ embeds: [errorDevEmbed] }).catch((e) => {
const channel = message.channel.type === 'DM' ? message.channel.recipient.tag : message.channel.name;
void client.console.warn(heading, `Failed to send owner error stack in <<${channel}>>.` + e?.stack || e);
})) ?? client.console.error(heading, `Failed to send owner error stack.` + error?.stack || error, false);
}
}
- const channel = message.channel.type === 'DM' ? message.channel.recipient.tag : message.channel.name;
void client.console.error(
heading,
`an error occurred with the <<${command}>> ${isSlash ? 'slash ' : ''}command in <<${channel}>> triggered by <<${