diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-31 22:46:32 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-31 22:46:32 -0400 |
commit | 710c1b9cc95d4f9cc5a437952c4cf89eca3f16cd (patch) | |
tree | c617d38a53064667e8d501aa1ed539ca1d8db3f7 /src | |
parent | 2f2a85707737753b23c8036de085c322641695e1 (diff) | |
download | tanzanite-710c1b9cc95d4f9cc5a437952c4cf89eca3f16cd.tar.gz tanzanite-710c1b9cc95d4f9cc5a437952c4cf89eca3f16cd.tar.bz2 tanzanite-710c1b9cc95d4f9cc5a437952c4cf89eca3f16cd.zip |
misc fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/dev/setLevel.ts | 2 | ||||
-rw-r--r-- | src/commands/dev/test.ts | 2 | ||||
-rw-r--r-- | src/commands/moderation/slowmode.ts | 1 | ||||
-rw-r--r-- | src/commands/skyblock-reborn/chooseColor.ts | 3 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClientUtil.ts | 1 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushGuild.ts | 14 | ||||
-rw-r--r-- | src/listeners/commands/commandError.ts | 3 | ||||
-rw-r--r-- | src/listeners/other/promiseRejection.ts | 2 | ||||
-rw-r--r-- | src/listeners/other/uncaughtException.ts | 2 | ||||
-rw-r--r-- | src/tasks/removeExpiredPunishements.ts | 6 |
10 files changed, 25 insertions, 11 deletions
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; } |