aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-31 22:46:32 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-31 22:46:32 -0400
commit710c1b9cc95d4f9cc5a437952c4cf89eca3f16cd (patch)
treec617d38a53064667e8d501aa1ed539ca1d8db3f7
parent2f2a85707737753b23c8036de085c322641695e1 (diff)
downloadtanzanite-710c1b9cc95d4f9cc5a437952c4cf89eca3f16cd.tar.gz
tanzanite-710c1b9cc95d4f9cc5a437952c4cf89eca3f16cd.tar.bz2
tanzanite-710c1b9cc95d4f9cc5a437952c4cf89eca3f16cd.zip
misc fixes
-rw-r--r--package.json8
-rw-r--r--src/commands/dev/setLevel.ts2
-rw-r--r--src/commands/dev/test.ts2
-rw-r--r--src/commands/moderation/slowmode.ts1
-rw-r--r--src/commands/skyblock-reborn/chooseColor.ts3
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts1
-rw-r--r--src/lib/extensions/discord.js/BushGuild.ts14
-rw-r--r--src/listeners/commands/commandError.ts3
-rw-r--r--src/listeners/other/promiseRejection.ts2
-rw-r--r--src/listeners/other/uncaughtException.ts2
-rw-r--r--src/tasks/removeExpiredPunishements.ts6
11 files changed, 32 insertions, 12 deletions
diff --git a/package.json b/package.json
index d709a3f..fa9376c 100644
--- a/package.json
+++ b/package.json
@@ -113,7 +113,13 @@
],
"@typescript-eslint/no-floating-promises": "warn",
"prefer-promise-reject-errors": "warn",
- "no-throw-literal": "warn"
+ "@typescript-eslint/no-misused-promises": "error",
+ "@typescript-eslint/no-base-to-string": "error",
+ "no-loss-of-precision": "off",
+ "@typescript-eslint/no-loss-of-precision": "error",
+ "no-throw-literal": "off",
+ "@typescript-eslint/no-throw-literal": "warn",
+ "@typescript-eslint/prefer-nullish-coalescing": "warn"
}
},
"prettier": {
diff --git a/src/commands/dev/setLevel.ts b/src/commands/dev/setLevel.ts
index 6603fcf..97527fa 100644
--- a/src/commands/dev/setLevel.ts
+++ b/src/commands/dev/setLevel.ts
@@ -48,7 +48,7 @@ export default class SetLevelCommand extends BushCommand {
});
}
- override async exec(
+ public override async exec(
message: BushMessage | BushSlashMessage,
{ user, level }: { user: User; level: number }
): Promise<unknown> {
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index 0029a3a..5552803 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -136,8 +136,10 @@ export default class TestCommand extends BushCommand {
// })
// );
const guildCommands = await message.guild.commands.fetch();
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
guildCommands.forEach(async (command) => await command.delete());
const globalCommands = await client.application.commands.fetch();
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
globalCommands.forEach(async (command) => await command.delete());
return await message.util.reply(
diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts
index fd3aec6..ec9a9de 100644
--- a/src/commands/moderation/slowmode.ts
+++ b/src/commands/moderation/slowmode.ts
@@ -82,6 +82,7 @@ export default class SlowModeCommand extends BushCommand {
);
else
return await message.util.reply(
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
`${util.emojis.success} Successfully changed the slowmode of ${channel} ${
length2 ? `to \`${util.humanizeDuration(length2)}` : '`off'
}\`.`
diff --git a/src/commands/skyblock-reborn/chooseColor.ts b/src/commands/skyblock-reborn/chooseColor.ts
index 3814670..a912954 100644
--- a/src/commands/skyblock-reborn/chooseColor.ts
+++ b/src/commands/skyblock-reborn/chooseColor.ts
@@ -168,7 +168,8 @@ export default class ChooseColorCommand extends BushCommand {
if (memberColorRoles.size) {
memberColorRoles.forEach(
- (role) => (message.member as BushGuildMember).roles.remove(role),
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
+ async (role: Role) => await (message.member as BushGuildMember).roles.remove(role),
'Removing Duplicate Color Roles.'
);
}
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index cf8364e..af64624 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -732,6 +732,7 @@ export class BushClientUtil extends ClientUtil {
success = false;
});
if (entries) {
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
entries.forEach(async (entry) => {
await entry.destroy().catch((e) => {
void client.console.error('removePunishmentEntry', e?.stack || e);
diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts
index acfe5da..9468941 100644
--- a/src/lib/extensions/discord.js/BushGuild.ts
+++ b/src/lib/extensions/discord.js/BushGuild.ts
@@ -48,12 +48,14 @@ export class BushGuild extends Guild {
let notBanned = false;
if (!bans.has(user)) notBanned = true;
- const unbanSuccess = this.bans.remove(user, `${moderator.tag} | ${options.reason || 'No reason provided.'}`).catch((e) => {
- if (e?.code === 'UNKNOWN_BAN') {
- notBanned = true;
- return true;
- } else return false;
- });
+ const unbanSuccess = await this.bans
+ .remove(user, `${moderator.tag} | ${options.reason || 'No reason provided.'}`)
+ .catch((e) => {
+ if (e?.code === 'UNKNOWN_BAN') {
+ notBanned = true;
+ return true;
+ } else return false;
+ });
if (!unbanSuccess) return 'error unbanning';
diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts
index 22ed0c6..f7bd44d 100644
--- a/src/listeners/commands/commandError.ts
+++ b/src/listeners/commands/commandError.ts
@@ -21,12 +21,14 @@ export default class CommandErrorListener extends BushListener {
const errorNo = Math.floor(Math.random() * 6969696969) + 69; // hehe funny number
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'))
.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})`,
`**Message:** [link](${message.url})`
];
@@ -60,6 +62,7 @@ export default class CommandErrorListener extends BushListener {
.setTitle(`A Command Error Occurred ${error?.code ? `\`${error.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'));
(await message.util?.send({ embeds: [errorDevEmbed] }).catch((e) => {
const channel = message.channel.type === 'DM' ? message.channel.recipient.tag : message.channel.name;
diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts
index f2623c6..ed0d35d 100644
--- a/src/listeners/other/promiseRejection.ts
+++ b/src/listeners/other/promiseRejection.ts
@@ -9,11 +9,13 @@ export default class PromiseRejectionListener extends BushListener {
}
public override async exec(error: Error): Promise<void> {
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
void client.console.error('PromiseRejection', `An unhanded promise rejection occurred:\n${error?.stack || error}`, false);
void client.console.channelError({
embeds: [
{
title: 'Unhandled promise rejection',
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
fields: [{ name: 'error', value: await util.codeblock(`${error?.stack || error}`, 1024, 'js') }],
color: util.colors.error
}
diff --git a/src/listeners/other/uncaughtException.ts b/src/listeners/other/uncaughtException.ts
index 76afab9..045e524 100644
--- a/src/listeners/other/uncaughtException.ts
+++ b/src/listeners/other/uncaughtException.ts
@@ -9,11 +9,13 @@ export default class UncaughtExceptionListener extends BushListener {
}
public override async exec(error: Error): Promise<void> {
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
void client.console.error('uncaughtException', `An uncaught exception occurred:\n${error?.stack || error}`, false);
void client.console.channelError({
embeds: [
{
title: 'An uncaught exception occurred',
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
fields: [{ name: 'error', value: await util.codeblock(`${error?.stack || error}`, 1024, 'js') }],
color: util.colors.error
}
diff --git a/src/tasks/removeExpiredPunishements.ts b/src/tasks/removeExpiredPunishements.ts
index 3d7528b..4ad1794 100644
--- a/src/tasks/removeExpiredPunishements.ts
+++ b/src/tasks/removeExpiredPunishements.ts
@@ -40,7 +40,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask {
case ActivePunishmentType.BAN: {
const result = await guild.unban({ user: entry.user, reason: 'Punishment expired.' });
if (['success', 'user not banned'].includes(result)) await entry.destroy();
- else throw result;
+ else throw new Error(result);
void client.logger.verbose(`removeExpiredPunishments`, `Unbanned ${entry.user}.`);
break;
}
@@ -51,7 +51,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask {
case ActivePunishmentType.MUTE: {
const result = await member.unmute({ reason: 'Punishment expired.' });
if (['success', 'failed to dm'].includes(result)) await entry.destroy();
- else throw result;
+ else throw new Error(result);
void client.logger.verbose(`removeExpiredPunishments`, `Unmuted ${entry.user}.`);
break;
}
@@ -64,7 +64,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask {
});
if (['success', 'failed to dm'].includes(result)) await entry.destroy();
- else throw result;
+ else throw new Error(result);
void client.logger.verbose(`removeExpiredPunishments`, `Removed a punishment role from ${entry.user}.`);
break;
}