diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/dev/eval.ts | 9 | ||||
-rw-r--r-- | src/commands/info/userInfo.ts | 2 | ||||
-rw-r--r-- | src/commands/moderation/slowmode.ts | 3 | ||||
-rw-r--r-- | src/commands/moulberry-bush/capes.ts | 2 | ||||
-rw-r--r-- | src/commands/utilities/activity.ts | 1 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClient.ts | 5 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClientUtil.ts | 38 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushCommand.ts | 1 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushGuildMember.ts | 51 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushMessage.ts | 8 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushThreadMember.ts | 1 | ||||
-rw-r--r-- | src/lib/utils/BushConstants.ts | 5 | ||||
-rw-r--r-- | src/lib/utils/BushLogger.ts | 23 | ||||
-rw-r--r-- | src/listeners/commands/commandError.ts | 6 | ||||
-rw-r--r-- | src/listeners/guild/guildMemberAdd.ts | 2 | ||||
-rw-r--r-- | src/listeners/message/automodUpdate.ts | 1 | ||||
-rw-r--r-- | src/listeners/other/consoleListener.ts | 4 | ||||
-rw-r--r-- | src/listeners/other/promiseRejection.ts | 2 |
18 files changed, 83 insertions, 81 deletions
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index 3bc2eed..cbc6518 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -99,20 +99,23 @@ export default class EvalCommand extends BushCommand { { ActivePunishment, Global, Guild, Level, ModLog, StickyRole } = await import('@lib'), { ButtonInteraction, + Collection, Collector, CommandInteraction, + ContextMenuInteraction, + DMChannel, + Emoji, Interaction, + InteractionCollector, Message, MessageActionRow, MessageAttachment, MessageButton, MessageCollector, - InteractionCollector, MessageEmbed, MessageSelectMenu, ReactionCollector, - Util, - Collection + Util } = await import('discord.js'), { Canvas } = await import('canvas'); /* eslint-enable @typescript-eslint/no-unused-vars */ diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 9fddd67..4e60f4c 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -180,7 +180,7 @@ export default class UserInfoCommand extends BushCommand { } if (perms.length) userEmbed.addField('ยป Important Perms', perms.join(' ')); - if (emojis) userEmbed.setDescription('\u200B' /*zero width space*/ + emojis.join(' ')); + if (emojis) userEmbed.setDescription(`\u200B${emojis.join(' ')}`); // zero width space return await message.util.reply({ embeds: [userEmbed] }); } diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts index 04fe3e4..4b3a976 100644 --- a/src/commands/moderation/slowmode.ts +++ b/src/commands/moderation/slowmode.ts @@ -81,8 +81,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} ${ + `${util.emojis.success} Successfully changed the slowmode of <#${channel.id}> ${ length2 ? `to \`${util.humanizeDuration(length2)}` : '`off' }\`.` ); diff --git a/src/commands/moulberry-bush/capes.ts b/src/commands/moulberry-bush/capes.ts index 447d604..14a972e 100644 --- a/src/commands/moulberry-bush/capes.ts +++ b/src/commands/moulberry-bush/capes.ts @@ -90,9 +90,7 @@ export default class CapesCommand extends BushCommand { const sortedCapes = capes1.sort((a, b) => { let aWeight: number | undefined = undefined, bWeight: number | undefined = undefined; - // eslint-disable-next-line prefer-const aWeight ??= a?.index; - // eslint-disable-next-line prefer-const bWeight ??= b?.index; if (aWeight !== undefined && bWeight !== undefined) { diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts index c0ab2a2..2d818e7 100644 --- a/src/commands/utilities/activity.ts +++ b/src/commands/utilities/activity.ts @@ -18,7 +18,6 @@ function map(phase: string) { else return undefined; } -// eslint-disable-next-line @typescript-eslint/no-unused-vars const activityTypeCaster = (_message: Message | BushMessage | BushSlashMessage, phrase: string) => { if (!phrase) return null; const mappedPhrase = map(phrase); diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 2eaf3d3..8a21d32 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -304,7 +304,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re } catch (e) { await this.console.error( 'startup', - `Failed to connect to <<database>> with error:\n` + typeof e === 'object' ? e?.stack : e, + `Failed to connect to <<database>> with error:\n${typeof e}` === 'object' ? e?.stack : e, false ); } @@ -312,7 +312,6 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re /** Starts the bot */ public async start(): Promise<void> { - // eslint-disable-next-line @typescript-eslint/no-this-alias const that = this; eventsIntercept.patch(this); //@ts-ignore: no typings @@ -321,7 +320,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re return guild.members.fetch(); }); await Promise.all(promises); - return done(null, 'intercepted ' + arg); + return done(null, `intercepted ${arg}`); }); // global objects diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index fa5e3b0..c80bfb2 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ - import { BushArgumentType, BushCache, @@ -732,7 +730,7 @@ export class BushClientUtil extends ClientUtil { } else { await interaction ?.update({ - content: `${text ? text + '\n' : ''}Command closed by user.`, + content: `${text ? `${text}\n` : ''}Command closed by user.`, embeds: [], components: [] }) @@ -860,13 +858,13 @@ export class BushClientUtil extends ClientUtil { */ public async codeblock(code: string, length: number, language?: CodeBlockLang): Promise<string> { let hasteOut = ''; - const prefix = '```' + language + '\n'; + const prefix = `\`\`\`${language}\n`; const suffix = '\n```'; language = language ?? 'txt'; if (code.length + (prefix + suffix).length >= length) - hasteOut = 'Too large to display. Hastebin: ' + (await this.haste(code)); + hasteOut = `Too large to display. Hastebin: ${await this.haste(code)}`; - const FormattedHaste = hasteOut.length ? '\n' + hasteOut : ''; + const FormattedHaste = hasteOut.length ? `\n${hasteOut}` : ''; const shortenedCode = hasteOut ? code.substring(0, length - (prefix + FormattedHaste + suffix).length) : code; const code3 = code.length ? prefix + shortenedCode + suffix + FormattedHaste : prefix + suffix; if (code3.length > length) { @@ -1071,13 +1069,13 @@ export class BushClientUtil extends ClientUtil { * @param type - The type of punishment - used to format the response. * @param checkModerator - Whether or not to check if the victim is a moderator. */ - public moderationPermissionCheck( + public async moderationPermissionCheck( moderator: BushGuildMember, victim: BushGuildMember, type: 'mute' | 'unmute' | 'warn' | 'kick' | 'ban' | 'unban' | 'add a punishment role to' | 'remove a punishment role from', checkModerator = true, force = false - ): true | string { + ): Promise<true | string> { if (force) return true; // If the victim is not in the guild anymore it will be undefined @@ -1086,18 +1084,30 @@ export class BushClientUtil extends ClientUtil { if (moderator.guild.id !== victim.guild.id) { throw new Error('moderator and victim not in same guild'); } + const isOwner = moderator.guild.ownerId === moderator.id; - if (moderator.id === victim.id) { + if (moderator.id === victim.id && !type.startsWith('un')) { return `${util.emojis.error} You cannot ${type} yourself.`; } - if (moderator.roles.highest.position <= victim.roles.highest.position && !isOwner) { + if ( + moderator.roles.highest.position <= victim.roles.highest.position && + !isOwner && + !(type.startsWith('un') && moderator.id === victim.id) + ) { return `${util.emojis.error} You cannot ${type} **${victim.user.tag}** because they have higher or equal role hierarchy as you do.`; } - if (victim.roles.highest.position >= victim.guild.me!.roles.highest.position) { + if ( + victim.roles.highest.position >= victim.guild.me!.roles.highest.position && + !(type.startsWith('un') && moderator.id === victim.id) + ) { return `${util.emojis.error} You cannot ${type} **${victim.user.tag}** because they have higher or equal role hierarchy as I do.`; } - if (checkModerator && victim.permissions.has('MANAGE_MESSAGES')) { - return `${util.emojis.error} You cannot ${type} **${victim.user.tag}** because they are a moderator.`; + if (checkModerator && victim.permissions.has('MANAGE_MESSAGES') && !(type.startsWith('un') && moderator.id === victim.id)) { + if (await moderator.guild.hasFeature('modsCanPunishMods')) { + return true; + } else { + return `${util.emojis.error} You cannot ${type} **${victim.user.tag}** because they are a moderator.`; + } } return true; } @@ -1249,7 +1259,7 @@ export class BushClientUtil extends ClientUtil { vw.setUint32(0, parseInt(hex, 16), false); const arrByte = new Uint8Array(arrBuff); - return arrByte[1] + ', ' + arrByte[2] + ', ' + arrByte[3]; + return `${arrByte[1]}, ${arrByte[2]}, ${arrByte[3]}`; } /* eslint-disable @typescript-eslint/no-unused-vars */ diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts index 3a2c619..35046d7 100644 --- a/src/lib/extensions/discord-akairo/BushCommand.ts +++ b/src/lib/extensions/discord-akairo/BushCommand.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ 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.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts index 67fa2fa..2c41873 100644 --- a/src/lib/extensions/discord.js/BushGuildMember.ts +++ b/src/lib/extensions/discord.js/BushGuildMember.ts @@ -1,5 +1,4 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -import { GuildMember, Partialize, Role } from 'discord.js'; +import { GuildMember, MessageEmbed, Partialize, Role } from 'discord.js'; import { RawGuildMemberData } from 'discord.js/typings/rawDataTypes'; import { ModLogType } from '../../models/ModLog'; import { BushClient, BushUserResolvable } from '../discord-akairo/BushClient'; @@ -86,6 +85,21 @@ export class BushGuildMember extends GuildMember { super(client, data, guild); } + private async punishDM(punishment: string, reason?: string | null, duration?: number, sendFooter = true): Promise<boolean> { + const ending = await this.guild.getSetting('punishmentEnding'); + const dmEmbed = + ending && ending.length && sendFooter + ? new MessageEmbed().setDescription(ending).setColor(util.colors.newBlurple) + : undefined; + const dmSuccess = await this.send({ + content: `You have been ${punishment} in **${this.guild.name}** ${ + duration !== null || duration !== undefined ? (duration ? `for ${util.humanizeDuration(duration)}` : 'permanently') : '' + }for **${reason ?? 'No reason provided'}**.${ending ? `\n\n${ending}` : ''}`, + embeds: dmEmbed ? [dmEmbed] : undefined + }).catch(() => false); + return !!dmSuccess; + } + public async warn(options: BushPunishmentOptions): Promise<{ result: WarnResponse | null; caseNum: number | null }> { const moderator = (await util.resolveNonCachedUser(options.moderator ?? this.guild.me))!; @@ -103,13 +117,7 @@ export class BushGuildMember extends GuildMember { if (!result || !result.log) return { result: 'error creating modlog entry', caseNum: null }; // dm user - const ending = await this.guild.getSetting('punishmentEnding'); - const dmSuccess = await this.send({ - content: `You have been warned in **${this.guild.name}** for **${options.reason ?? 'No reason provided'}**.${ - ending ? `\n\n${ending}` : '' - }` - }).catch(() => false); - + const dmSuccess = await this.punishDM('warned', options.reason); if (!dmSuccess) return { result: 'failed to dm', caseNum: result.caseNum }; return { result: 'success', caseNum: result.caseNum }; @@ -244,12 +252,7 @@ export class BushGuildMember extends GuildMember { if (!punishmentEntrySuccess) return 'error creating mute entry'; // dm user - const ending = await this.guild.getSetting('punishmentEnding'); - const dmSuccess = await this.send({ - content: `You have been muted ${ - options.duration ? 'for ' + util.humanizeDuration(options.duration) : 'permanently' - } in **${this.guild.name}** for **${options.reason ?? 'No reason provided'}**.${ending ? `\n\n${ending}` : ''}` - }).catch(() => false); + const dmSuccess = await this.punishDM('muted', options.reason, options.duration ?? 0); if (!dmSuccess) return 'failed to dm'; @@ -297,9 +300,7 @@ export class BushGuildMember extends GuildMember { if (!removePunishmentEntrySuccess) return 'error removing mute entry'; //dm user - const dmSuccess = await this.send({ - content: `You have been unmuted in **${this.guild.name}** because **${options.reason ?? 'No reason provided'}**.` - }).catch(() => false); + const dmSuccess = await this.punishDM('unmuted', options.reason, undefined, false); if (!dmSuccess) return 'failed to dm'; @@ -313,12 +314,7 @@ export class BushGuildMember extends GuildMember { const moderator = (await util.resolveNonCachedUser(options.moderator ?? this.guild.me))!; // dm user - const ending = await this.guild.getSetting('punishmentEnding'); - const dmSuccess = await this.send({ - content: `You have been kicked from **${this.guild.name}** for **${options.reason ?? 'No reason provided'}**.${ - ending ? `\n\n${ending}` : '' - }` - }).catch(() => false); + const dmSuccess = await this.punishDM('kicked', options.reason); // kick const kickSuccess = await this.kick(`${moderator?.tag} | ${options.reason ?? 'No reason provided.'}`).catch(() => false); @@ -344,12 +340,7 @@ export class BushGuildMember extends GuildMember { const moderator = (await util.resolveNonCachedUser(options.moderator ?? this.guild.me))!; // dm user - const ending = await this.guild.getSetting('punishmentEnding'); - const dmSuccess = await this.send({ - content: `You have been banned ${ - options?.duration ? 'for ' + util.humanizeDuration(options.duration) : 'permanently' - } from **${this.guild.name}** for **${options.reason ?? 'No reason provided'}**.${ending ? `\n\n${ending}` : ''}` - }).catch(() => false); + const dmSuccess = await this.punishDM('banned', options.reason, options.duration ?? 0); // ban const banSuccess = await this.ban({ diff --git a/src/lib/extensions/discord.js/BushMessage.ts b/src/lib/extensions/discord.js/BushMessage.ts index 7907efe..f2dd02c 100644 --- a/src/lib/extensions/discord.js/BushMessage.ts +++ b/src/lib/extensions/discord.js/BushMessage.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-empty-interface */ import { Message, Partialize } from 'discord.js'; import { RawMessageData } from 'discord.js/typings/rawDataTypes'; import { BushClient, BushTextBasedChannels } from '../discord-akairo/BushClient'; @@ -7,8 +6,11 @@ import { BushGuild } from './BushGuild'; import { BushGuildMember } from './BushGuildMember'; import { BushUser } from './BushUser'; -export interface PartialBushMessage - extends Partialize<BushMessage, 'type' | 'system' | 'pinned' | 'tts', 'content' | 'cleanContent' | 'author'> {} +export type PartialBushMessage = Partialize< + BushMessage, + 'type' | 'system' | 'pinned' | 'tts', + 'content' | 'cleanContent' | 'author' +>; export class BushMessage extends Message { public declare readonly client: BushClient; public override util!: BushCommandUtil; diff --git a/src/lib/extensions/discord.js/BushThreadMember.ts b/src/lib/extensions/discord.js/BushThreadMember.ts index 77f2b20..10c7e84 100644 --- a/src/lib/extensions/discord.js/BushThreadMember.ts +++ b/src/lib/extensions/discord.js/BushThreadMember.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/ban-types */ import { ThreadMember } from 'discord.js'; import { RawThreadMemberData } from 'discord.js/typings/rawDataTypes'; import { BushGuildMember } from './BushGuildMember'; diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index 9eb96b3..5698b67 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -9,6 +9,7 @@ interface bushColors { aqua: '#00bbff'; purple: '#8400ff'; blurple: '#5440cd'; + newBlurple: '#5865f2'; pink: '#ff00e6'; green: '#00ff1e'; darkGreen: '#008f11'; @@ -98,6 +99,7 @@ export class BushConstants { aqua: '#00bbff', purple: '#8400ff', blurple: '#5440cd', + newBlurple: '#5865f2', pink: '#ff00e6', green: '#00ff1e', darkGreen: '#008f11', @@ -149,8 +151,7 @@ export class BushConstants { public static regex = { snowflake: /\d{15,21}/im, - // eslint-disable-next-line no-useless-escape - discordEmoji: /<a?:(?<name>[a-zA-Z0-9\_]+):(?<id>\d{15,21})>/im + discordEmoji: /<a?:(?<name>[a-zA-Z0-9_]+):(?<id>\d{15,21})>/im }; public static pronounMapping: { [x in PronounCode]: Pronoun } = { diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts index fd0aa4d..c2a9989 100644 --- a/src/lib/utils/BushLogger.ts +++ b/src/lib/utils/BushLogger.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import chalk from 'chalk'; import { Message, MessageEmbed, Util } from 'discord.js'; import { inspect } from 'util'; @@ -105,7 +104,7 @@ export class BushLogger { if (!client.config.logging.verbose) return; const newContent = this.#inspectContent(content, depth, true); console.info( - `${chalk.bgGrey(this.#getTimeStamp())} ${chalk.grey(`[${header}]`)} ` + this.#parseFormatting(newContent, 'blackBright') + `${chalk.bgGrey(this.#getTimeStamp())} ${chalk.grey(`[${header}]`)} ${this.#parseFormatting(newContent, 'blackBright')}` ); if (!sendChannel) return; const embed = new MessageEmbed() @@ -126,7 +125,7 @@ export class BushLogger { if (!client.config.logging.info) return; const newContent = this.#inspectContent(content, depth, true); console.info( - `${chalk.bgCyan(this.#getTimeStamp())} ${chalk.cyan(`[${header}]`)} ` + this.#parseFormatting(newContent, 'blueBright') + `${chalk.bgCyan(this.#getTimeStamp())} ${chalk.cyan(`[${header}]`)} ${this.#parseFormatting(newContent, 'blueBright')}` ); if (!sendChannel) return; const embed = new MessageEmbed() @@ -146,8 +145,10 @@ export class BushLogger { public static async warn(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { const newContent = this.#inspectContent(content, depth, true); console.warn( - `${chalk.bgYellow(this.#getTimeStamp())} ${chalk.yellow(`[${header}]`)} ` + - this.#parseFormatting(newContent, 'yellowBright') + `${chalk.bgYellow(this.#getTimeStamp())} ${chalk.yellow(`[${header}]`)} ${this.#parseFormatting( + newContent, + 'yellowBright' + )}` ); if (!sendChannel) return; @@ -168,8 +169,10 @@ export class BushLogger { public static async error(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { const newContent = this.#inspectContent(content, depth, true); console.error( - `${chalk.bgRedBright(this.#getTimeStamp())} ${chalk.redBright(`[${header}]`)} ` + - this.#parseFormatting(newContent, 'redBright') + `${chalk.bgRedBright(this.#getTimeStamp())} ${chalk.redBright(`[${header}]`)} ${this.#parseFormatting( + newContent, + 'redBright' + )}` ); if (!sendChannel) return; const embed = new MessageEmbed() @@ -190,8 +193,10 @@ export class BushLogger { public static async success(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { const newContent = this.#inspectContent(content, depth, true); console.log( - `${chalk.bgGreen(this.#getTimeStamp())} ${chalk.greenBright(`[${header}]`)} ` + - this.#parseFormatting(newContent, 'greenBright') + `${chalk.bgGreen(this.#getTimeStamp())} ${chalk.greenBright(`[${header}]`)} ${this.#parseFormatting( + newContent, + 'greenBright' + )}` ); if (!sendChannel) return; const embed = new MessageEmbed() diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts index d24c0f0..bde74f0 100644 --- a/src/listeners/commands/commandError.ts +++ b/src/listeners/commands/commandError.ts @@ -30,7 +30,7 @@ export default class CommandErrorListener extends BushListener { `${isSlash ? 'slashC' : 'c'}ommandError`, `an error occurred with the <<${command}>> ${isSlash ? 'slash ' : ''}command in <<${channel}>> triggered by <<${ message?.author?.tag - }>>:\n` + error?.stack || error, + }>>:\n${error?.stack}` || error, false ); @@ -115,9 +115,7 @@ export default class CommandErrorListener extends BushListener { `**Error ${util.capitalizeFirstLetter(element)}:** ${ typeof (options.error as any)[element] === 'object' ? `[haste](${await util.inspectCleanRedactHaste((options.error as any)[element], inspectOptions)})` - : '`' + - util.discord.escapeInlineCode(util.inspectAndRedact((options.error as any)[element], inspectOptions)) + - '`' + : `\`${util.discord.escapeInlineCode(util.inspectAndRedact((options.error as any)[element], inspectOptions))}\`` }` ); } diff --git a/src/listeners/guild/guildMemberAdd.ts b/src/listeners/guild/guildMemberAdd.ts index e0a0426..ca10cd7 100644 --- a/src/listeners/guild/guildMemberAdd.ts +++ b/src/listeners/guild/guildMemberAdd.ts @@ -81,7 +81,7 @@ export default class GuildMemberAddListener extends BushListener { if (failedRoles.length) { void this.client.console.warn( 'guildMemberAdd', - 'Failed assigning the following roles on Fallback:' + failedRoles + `Failed assigning the following roles on Fallback:${failedRoles}` ); } else { void this.client.console.info( diff --git a/src/listeners/message/automodUpdate.ts b/src/listeners/message/automodUpdate.ts index 2dd86a2..9ef229e 100644 --- a/src/listeners/message/automodUpdate.ts +++ b/src/listeners/message/automodUpdate.ts @@ -11,7 +11,6 @@ export default class AutomodMessageUpdateListener extends BushListener { }); } - // eslint-disable-next-line @typescript-eslint/no-unused-vars public override async exec(...[_, newMessage]: BushClientEvents['messageUpdate']): Promise<unknown> { const fullMessage = newMessage.partial ? await newMessage.fetch() : (newMessage as BushMessage); return await AutomodMessageCreateListener.automod(fullMessage); diff --git a/src/listeners/other/consoleListener.ts b/src/listeners/other/consoleListener.ts index c983a58..ef43726 100644 --- a/src/listeners/other/consoleListener.ts +++ b/src/listeners/other/consoleListener.ts @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ -/* eslint-disable @typescript-eslint/no-unused-vars */ import { BushListener } from '@lib'; import { exec } from 'child_process'; import { promisify } from 'util'; @@ -14,6 +12,7 @@ export default class ConsoleListener extends BushListener { public override async exec(line: string): Promise<void> { if (line.startsWith('eval ') || line.startsWith('ev ')) { + /* eslint-disable @typescript-eslint/no-unused-vars */ const sh = promisify(exec), bot = client, config = client.config, @@ -35,6 +34,7 @@ export default class ConsoleListener extends BushListener { Util, Collection } = await import('discord.js'); + /* eslint-enable @typescript-eslint/no-unused-vars */ try { const input = line.replace('eval ', '').replace('ev ', ''); let output = eval(input); diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts index d60c9c7..8785b78 100644 --- a/src/listeners/other/promiseRejection.ts +++ b/src/listeners/other/promiseRejection.ts @@ -11,7 +11,7 @@ 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.error('promiseRejection', `An unhanded promise rejection occurred:\n${error.stack ?? error}`, false); void client.console.channelError({ embeds: [await CommandErrorListener.generateErrorEmbed({ type: 'unhandledRejection', error: error })] }); |