Fix some more eslint & ts errors
diff --git a/src/Unfinished/categorisationTest.ts b/src/Unfinished/categorisationTest.ts
index e4346d6..8c25eb2 100644
--- a/src/Unfinished/categorisationTest.ts
+++ b/src/Unfinished/categorisationTest.ts
@@ -7,7 +7,8 @@
MessageSelectMenu
} from "discord.js";
import { SlashCommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
+// @ts-expect-error
+import type { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
import client from "../utils/client.js";
import addPlural from "../utils/plurals.js";
@@ -17,9 +18,7 @@
.setName("categorise")
.setDescription("Categorises your servers channels");
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<unknown> => {
const channels = interaction.guild.channels.cache.filter(
(c) => c.type !== "GUILD_CATEGORY"
);
diff --git a/src/commands/mod/info.ts b/src/commands/mod/info.ts
index 86a4c4a..9837273 100644
--- a/src/commands/mod/info.ts
+++ b/src/commands/mod/info.ts
@@ -1,4 +1,4 @@
-import { HistorySchema } from "../../utils/database";
+import { HistorySchema } from "../../utils/database.js";
import Discord, {
CommandInteraction,
GuildMember,
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index 5be6f43..b430191 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -71,17 +71,15 @@
.setRequired(false)
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<unknown> => {
const { log, NucleusColors, renderUser, entry, renderDelta } =
client.logger;
const user = interaction.options.getMember("user") as GuildMember;
const time = {
- days: interaction.options.getInteger("days") || 0,
- hours: interaction.options.getInteger("hours") || 0,
- minutes: interaction.options.getInteger("minutes") || 0,
- seconds: interaction.options.getInteger("seconds") || 0
+ days: interaction.options.getInteger("days") ?? 0,
+ hours: interaction.options.getInteger("hours") ?? 0,
+ minutes: interaction.options.getInteger("minutes") ?? 0,
+ seconds: interaction.options.getInteger("seconds") ?? 0
};
const config = await client.database.guilds.read(interaction.guild.id);
let serverSettingsDescription = config.moderation.mute.timeout
diff --git a/src/commands/settings/logs/attachment.ts b/src/commands/settings/logs/attachment.ts
index f37bd1a..ea8aa51 100644
--- a/src/commands/settings/logs/attachment.ts
+++ b/src/commands/settings/logs/attachment.ts
@@ -1,5 +1,5 @@
import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
-import { ChannelType } from "discord-api-types";
+import { ChannelType } from "discord-api-types/v9";
import Discord, {
CommandInteraction,
MessageActionRow,
diff --git a/src/commands/settings/logs/channel.ts b/src/commands/settings/logs/channel.ts
index 00d2411..fd64424 100644
--- a/src/commands/settings/logs/channel.ts
+++ b/src/commands/settings/logs/channel.ts
@@ -1,5 +1,5 @@
import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
-import { ChannelType } from "discord-api-types";
+import { ChannelType } from "discord-api-types/v9";
import Discord, {
CommandInteraction,
MessageActionRow,
diff --git a/src/commands/settings/logs/staff.ts b/src/commands/settings/logs/staff.ts
index 718d13b..a0df97c 100644
--- a/src/commands/settings/logs/staff.ts
+++ b/src/commands/settings/logs/staff.ts
@@ -1,5 +1,5 @@
import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
-import { ChannelType } from "discord-api-types";
+import { ChannelType } from "discord-api-types/v9";
import Discord, {
CommandInteraction,
MessageActionRow,
@@ -9,7 +9,6 @@
import confirmationMessage from "../../../utils/confirmationMessage.js";
import getEmojiByName from "../../../utils/getEmojiByName.js";
import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import type { WrappedCheck } from "jshaiku";
import client from "../../../utils/client.js";
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index 5e5cbe7..206e157 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -19,7 +19,7 @@
SelectMenuOption,
SlashCommandSubcommandBuilder
} from "@discordjs/builders";
-import { ChannelType } from "discord-api-types";
+import { ChannelType } from "discord-api-types/v9";
import client from "../../utils/client.js";
import {
toHexInteger,
diff --git a/src/commands/settings/welcome.ts b/src/commands/settings/welcome.ts
index 3eb0ec5..00b1826 100644
--- a/src/commands/settings/welcome.ts
+++ b/src/commands/settings/welcome.ts
@@ -8,12 +8,12 @@
MessageComponentInteraction,
Role
} from "discord.js";
-import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import generateKeyValueList from "../../utils/generateKeyValueList.js";
-import { ChannelType } from "discord-api-types";
+import { ChannelType } from "discord-api-types/v9";
import getEmojiByName from "../../utils/getEmojiByName.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -49,9 +49,7 @@
.addChannelTypes([ChannelType.GuildText, ChannelType.GuildNews])
);
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<unknown> => {
const { renderRole, renderChannel, log, NucleusColors, entry, renderUser } =
client.logger;
await interaction.reply({
@@ -340,7 +338,9 @@
const check = (interaction: CommandInteraction) => {
const member = interaction.member as Discord.GuildMember;
if (!member.permissions.has("MANAGE_GUILD"))
- throw "You must have the *Manage Server* permission to use this command";
+ throw new Error(
+ "You must have the *Manage Server* permission to use this command"
+ );
return true;
};
diff --git a/src/commands/tags/edit.ts b/src/commands/tags/edit.ts
index 192a2d4..5aaec40 100644
--- a/src/commands/tags/edit.ts
+++ b/src/commands/tags/edit.ts
@@ -1,5 +1,5 @@
-import Discord, { CommandInteraction } from "discord.js";
-import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { CommandInteraction, GuildMember } from "discord.js";
+import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import keyValueList from "../../utils/generateKeyValueList.js";
@@ -28,10 +28,11 @@
.setDescription("The new name of the tag / Edit")
);
-const callback = async (interaction: CommandInteraction): Promise<void> => {
+const callback = async (interaction: CommandInteraction): Promise<unknown> => {
+ if (!interaction.guild) return;
const name = interaction.options.getString("name");
- const value = interaction.options.getString("value") || "";
- const newname = interaction.options.getString("newname") || "";
+ const value = interaction.options.getString("value") ?? "";
+ const newname = interaction.options.getString("newname") ?? "";
if (!newname && !value)
return await interaction.reply({
embeds: [
@@ -155,9 +156,11 @@
};
const check = (interaction: CommandInteraction) => {
- const member = interaction.member as Discord.GuildMember;
+ const member = interaction.member as GuildMember;
if (!member.permissions.has("MANAGE_MESSAGES"))
- throw "You must have the *Manage Messages* permission to use this command";
+ throw new Error(
+ "You must have the *Manage Messages* permission to use this command"
+ );
return true;
};
diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts
index 5f096ae..129359f 100644
--- a/src/commands/user/about.ts
+++ b/src/commands/user/about.ts
@@ -55,8 +55,9 @@
}
const callback = async (interaction: CommandInteraction): Promise<void> => {
+ if (!interaction.guild) return;
const { renderUser, renderDelta } = client.logger;
- const member = (interaction.options.getMember("user") ||
+ const member = (interaction.options.getMember("user") ??
interaction.member) as Discord.GuildMember;
const flags: string[] = [];
if (
@@ -107,26 +108,29 @@
};
const members = await interaction.guild.members.fetch();
const membersArray = [...members.values()];
- membersArray.sort((a, b) => a.joinedTimestamp - b.joinedTimestamp);
+ membersArray.sort((a, b) => {
+ if (a.joinedTimestamp === null) return 1;
+ if (b.joinedTimestamp === null) return -1;
+ return a.joinedTimestamp - b.joinedTimestamp;
+ });
const joinPos = membersArray.findIndex((m) => m.id === member.user.id);
const roles = member.roles.cache
- .filter((r) => r.id !== interaction.guild.id)
+ .filter((r) => r.id !== interaction.guild!.id)
.sort();
let s = "";
let count = 0;
let ended = false;
- roles.map((item) => {
- if (ended) return;
- const string = `<@&${item.id}>, `;
+ for (const roleId in roles) {
+ const string = `<@&${roleId}>, `;
if (s.length + string.length > 1000) {
ended = true;
s += `and ${roles.size - count} more`;
- return;
+ break;
}
count++;
s += string;
- });
+ }
if (s.length > 0 && !ended) s = s.slice(0, -2);
let perms = "";
diff --git a/src/commands/user/avatar.ts b/src/commands/user/avatar.ts
index 35c475f..502e9c8 100644
--- a/src/commands/user/avatar.ts
+++ b/src/commands/user/avatar.ts
@@ -19,7 +19,7 @@
const callback = async (interaction: CommandInteraction): Promise<void> => {
const { renderUser } = client.logger;
- const member = (interaction.options.getMember("user") ||
+ const member = (interaction.options.getMember("user") ??
interaction.member) as Discord.GuildMember;
await interaction.reply({
embeds: [
@@ -33,7 +33,7 @@
url: member.user.displayAvatarURL({ dynamic: true })
})
)
- .setImage(await member.user.displayAvatarURL({ dynamic: true }))
+ .setImage(member.user.displayAvatarURL({ dynamic: true }))
],
ephemeral: true,
fetchReply: true
diff --git a/src/commands/user/track.ts b/src/commands/user/track.ts
index e0e41e0..1a4c308 100644
--- a/src/commands/user/track.ts
+++ b/src/commands/user/track.ts
@@ -10,7 +10,6 @@
SelectMenuOption,
SlashCommandSubcommandBuilder
} from "@discordjs/builders";
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -45,9 +44,7 @@
return "TRACKS.VERTICAL.MIDDLE." + disabled + active;
};
-const callback = async (
- interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<unknown> => {
const { renderUser } = client.logger;
const member = interaction.options.getMember("user") as GuildMember;
const guild = interaction.guild;
@@ -57,7 +54,7 @@
let track = 0;
let generated;
const roles = await guild.roles.fetch();
- const memberRoles = await member.roles;
+ const memberRoles = member.roles;
let managed: boolean;
while (true) {
const data = config.tracks[track];
@@ -137,9 +134,8 @@
})
.join("\n");
const selected = [];
- for (let i = 0; i < data.track.length; i++) {
- if (memberRoles.cache.has(data.track[i]))
- selected.push(data.track[i]);
+ for (const position of data.track) {
+ if (memberRoles.cache.has(position)) selected.push(position);
}
const conflict = data.retainPrevious ? false : selected.length > 1;
let conflictDropdown;
@@ -278,7 +274,8 @@
) => {
const tracks = (await client.database.guilds.read(interaction.guild.id))
.tracks;
- if (tracks.length === 0) throw "This server does not have any tracks";
+ if (tracks.length === 0)
+ throw new Error("This server does not have any tracks");
const member = interaction.member as GuildMember;
// Allow the owner to promote anyone
if (member.id === interaction.guild.ownerId) return true;
@@ -297,7 +294,7 @@
}
// Check if the user has manage_roles permission
if (!managed && !member.permissions.has("MANAGE_ROLES"))
- throw "You do not have the *Manage Roles* permission";
+ throw new Error("You do not have the *Manage Roles* permission");
// Allow track
return true;
};
diff --git a/src/commands/verify.ts b/src/commands/verify.ts
index d1a0659..2319284 100644
--- a/src/commands/verify.ts
+++ b/src/commands/verify.ts
@@ -1,6 +1,5 @@
import type { CommandInteraction } from "discord.js";
import { SlashCommandBuilder } from "@discordjs/builders";
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import { WrappedCheck } from "jshaiku";
import verify from "../reflex/verify.js";
diff --git a/src/config/format.ts b/src/config/format.ts
index 3b977fb..7b68ebf 100644
--- a/src/config/format.ts
+++ b/src/config/format.ts
@@ -1,5 +1,4 @@
import fs from "fs";
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import * as readLine from "node:readline/promises";
diff --git a/src/events/channelDelete.ts b/src/events/channelDelete.ts
index af55205..ee46204 100644
--- a/src/events/channelDelete.ts
+++ b/src/events/channelDelete.ts
@@ -40,7 +40,17 @@
displayName = "Channel";
}
}
- const list = {
+ const list: {
+ channelId: string;
+ name: string;
+ topic?: string | null;
+ type: any;
+ category: any;
+ nsfw?: boolean | null;
+ created: any;
+ deleted: any;
+ deletedBy: any;
+ } = {
channelId: entry(channel.id, `\`${channel.id}\``),
name: entry(channel.id, `${channel.name}`),
topic: null,
diff --git a/src/events/guildCreate.ts b/src/events/guildCreate.ts
index 5ae4248..a5ada67 100644
--- a/src/events/guildCreate.ts
+++ b/src/events/guildCreate.ts
@@ -1,5 +1,4 @@
import type { Guild } from "discord.js";
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import type { HaikuClient } from "jshaiku";
import guide from "../reflex/guide.js";
diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts
index 53de4df..7e4a52f 100644
--- a/src/events/messageCreate.ts
+++ b/src/events/messageCreate.ts
@@ -1,4 +1,3 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import { HaikuClient } from "jshaiku";
import {
@@ -14,12 +13,11 @@
import getEmojiByName from "../utils/getEmojiByName.js";
import client from "../utils/client.js";
import { callback as a } from "../reflex/statsChannelUpdate.js";
-import type { Message } from "discord.js";
+import { Message, ThreadChannel } from "discord.js";
export const event = "messageCreate";
export async function callback(_client: HaikuClient, message: Message) {
- if (!message) return;
if (!message.guild) return;
if (message.author.bot) return;
if (message.channel.type === "DM") return;
@@ -112,129 +110,17 @@
if (fileNames.files.length > 0) {
for (const element of fileNames.files) {
- if (!message) return;
const url = element.url ? element.url : element.local;
- if (url !== undefined) {
+ if (
+ /\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/.test(url)
+ ) {
if (
- /\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/.test(
- url
- )
+ config.filters.images.NSFW &&
+ !(message.channel instanceof ThreadChannel
+ ? message.channel.parent?.nsfw
+ : message.channel.nsfw)
) {
- if (
- config.filters.images.NSFW &&
- !(message.channel.type === "GUILD_PUBLIC_THREAD"
- ? false
- : message.channel.nsfw)
- ) {
- if (await NSFWCheck(url)) {
- createLogException(
- message.guild.id,
- message.channel.id,
- message.id
- );
- await message.delete();
- const data = {
- meta: {
- type: "messageDelete",
- displayName: "Message Deleted",
- calculateType: "autoModeratorDeleted",
- color: NucleusColors.red,
- emoji: "MESSAGE.DELETE",
- timestamp: new Date().getTime()
- },
- separate: {
- start:
- filter +
- " Image detected as NSFW\n\n" +
- (content
- ? `**Message:**\n\`\`\`${content}\`\`\``
- : "**Message:** *Message had no content*")
- },
- list: list,
- hidden: {
- guild: message.channel.guild.id
- }
- };
- return log(data);
- }
- }
- if (config.filters.wordFilter.enabled) {
- const text = await TestImage(url);
- const check = TestString(
- text ?? "",
- config.filters.wordFilter.words.loose,
- config.filters.wordFilter.words.strict
- );
- if (check !== null) {
- createLogException(
- message.guild.id,
- message.channel.id,
- message.id
- );
- await message.delete();
- const data = {
- meta: {
- type: "messageDelete",
- displayName: "Message Deleted",
- calculateType: "autoModeratorDeleted",
- color: NucleusColors.red,
- emoji: "MESSAGE.DELETE",
- timestamp: new Date().getTime()
- },
- separate: {
- start:
- filter +
- " Image contained filtered word\n\n" +
- (content
- ? `**Message:**\n\`\`\`${content}\`\`\``
- : "**Message:** *Message had no content*")
- },
- list: list,
- hidden: {
- guild: message.channel.guild.id
- }
- };
- return log(data);
- }
- }
- if (config.filters.images.size) {
- if (url.match(/\.+(webp|png|jpg)$/gi)) {
- if (!(await SizeCheck(element))) {
- createLogException(
- message.guild.id,
- message.channel.id,
- message.id
- );
- await message.delete();
- const data = {
- meta: {
- type: "messageDelete",
- displayName: "Message Deleted",
- calculateType: "autoModeratorDeleted",
- color: NucleusColors.red,
- emoji: "MESSAGE.DELETE",
- timestamp: new Date().getTime()
- },
- separate: {
- start:
- filter +
- " Image was too small\n\n" +
- (content
- ? `**Message:**\n\`\`\`${content}\`\`\``
- : "**Message:** *Message had no content*")
- },
- list: list,
- hidden: {
- guild: message.channel.guild.id
- }
- };
- return log(data);
- }
- }
- }
- }
- if (config.filters.malware) {
- if (!MalwareCheck(url)) {
+ if (await NSFWCheck(url)) {
createLogException(
message.guild.id,
message.channel.id,
@@ -253,7 +139,7 @@
separate: {
start:
filter +
- " File detected as malware\n\n" +
+ " Image detected as NSFW\n\n" +
(content
? `**Message:**\n\`\`\`${content}\`\`\``
: "**Message:** *Message had no content*")
@@ -266,10 +152,116 @@
return log(data);
}
}
+ if (config.filters.wordFilter.enabled) {
+ const text = await TestImage(url);
+ const check = TestString(
+ text ?? "",
+ config.filters.wordFilter.words.loose,
+ config.filters.wordFilter.words.strict
+ );
+ if (check !== null) {
+ createLogException(
+ message.guild.id,
+ message.channel.id,
+ message.id
+ );
+ await message.delete();
+ const data = {
+ meta: {
+ type: "messageDelete",
+ displayName: "Message Deleted",
+ calculateType: "autoModeratorDeleted",
+ color: NucleusColors.red,
+ emoji: "MESSAGE.DELETE",
+ timestamp: new Date().getTime()
+ },
+ separate: {
+ start:
+ filter +
+ " Image contained filtered word\n\n" +
+ (content
+ ? `**Message:**\n\`\`\`${content}\`\`\``
+ : "**Message:** *Message had no content*")
+ },
+ list: list,
+ hidden: {
+ guild: message.channel.guild.id
+ }
+ };
+ return log(data);
+ }
+ }
+ if (config.filters.images.size) {
+ if (url.match(/\.+(webp|png|jpg)$/gi)) {
+ if (!(await SizeCheck(element))) {
+ createLogException(
+ message.guild.id,
+ message.channel.id,
+ message.id
+ );
+ await message.delete();
+ const data = {
+ meta: {
+ type: "messageDelete",
+ displayName: "Message Deleted",
+ calculateType: "autoModeratorDeleted",
+ color: NucleusColors.red,
+ emoji: "MESSAGE.DELETE",
+ timestamp: new Date().getTime()
+ },
+ separate: {
+ start:
+ filter +
+ " Image was too small\n\n" +
+ (content
+ ? `**Message:**\n\`\`\`${content}\`\`\``
+ : "**Message:** *Message had no content*")
+ },
+ list: list,
+ hidden: {
+ guild: message.channel.guild.id
+ }
+ };
+ return log(data);
+ }
+ }
+ }
+ }
+ if (config.filters.malware) {
+ if (!(await MalwareCheck(url))) {
+ createLogException(
+ message.guild.id,
+ message.channel.id,
+ message.id
+ );
+ await message.delete();
+ const data = {
+ meta: {
+ type: "messageDelete",
+ displayName: "Message Deleted",
+ calculateType: "autoModeratorDeleted",
+ color: NucleusColors.red,
+ emoji: "MESSAGE.DELETE",
+ timestamp: new Date().getTime()
+ },
+ separate: {
+ start:
+ filter +
+ " File detected as malware\n\n" +
+ (content
+ ? `**Message:**\n\`\`\`${content}\`\`\``
+ : "**Message:** *Message had no content*")
+ },
+ list: list,
+ hidden: {
+ guild: message.channel.guild.id
+ }
+ };
+ return log(data);
+ }
}
}
}
- if (!message) return;
const linkDetectionTypes = await LinkCheck(message);
if (linkDetectionTypes.length > 0) {
@@ -363,7 +355,6 @@
}
if (config.filters.pings.roles) {
for (const roleId in message.mentions.roles) {
- if (!message) return;
if (!config.filters.pings.allowed.roles.includes(roleId)) {
createLogException(
message.guild.id,
diff --git a/src/events/webhookUpdate.ts b/src/events/webhookUpdate.ts
index f600247..ae88cac 100644
--- a/src/events/webhookUpdate.ts
+++ b/src/events/webhookUpdate.ts
@@ -1,5 +1,4 @@
import type Discord from "discord.js";
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import type { HaikuClient } from "jshaiku";
export const event = "webhookUpdate";
diff --git a/src/index.ts b/src/index.ts
index e66dbb3..e40a816 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -5,8 +5,8 @@
import client from "./utils/client.js";
import EventScheduler from "./utils/eventScheduler.js";
-await client.registerCommandsIn("./commands");
-await client.registerEventsIn("./events");
+await client.registerCommandsIn(`dist/commands`);
+await client.registerEventsIn(`dist/events`);
client.on("ready", () => {
runServer(client);
});
diff --git a/src/premium/attachmentLogs.ts b/src/premium/attachmentLogs.ts
index 679627d..899cd25 100644
--- a/src/premium/attachmentLogs.ts
+++ b/src/premium/attachmentLogs.ts
@@ -22,7 +22,7 @@
size: attachment.size
});
}
- const links = message.content.match(/https?:\/\/\S+/gi) || [];
+ const links = message.content.match(/https?:\/\/\S+/gi) ?? [];
for (const link of links) {
if (
link
diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts
index 162b85a..2f6f526 100644
--- a/src/reflex/scanners.ts
+++ b/src/reflex/scanners.ts
@@ -1,4 +1,3 @@
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import * as us from "unscan";
import fetch from "node-fetch";
@@ -17,13 +16,13 @@
export async function testNSFW(link: string): Promise<NSFWSchema> {
const p = await saveAttachment(link);
const result = await us.nsfw.file(p);
- return result;
+ return { nsfw: result.nsfw ?? false };
}
export async function testMalware(link: string): Promise<MalwareSchema> {
const p = await saveAttachment(link);
const result = await us.malware.file(p);
- return result;
+ return { safe: result.safe ?? true };
}
export async function saveAttachment(link: string): Promise<string> {
diff --git a/src/utils/database.ts b/src/utils/database.ts
index 3592c95..140dbcc 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -1,6 +1,5 @@
import type Discord from "discord.js";
import { Collection, MongoClient } from "mongodb";
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import structuredClone from "@ungap/structured-clone";
import config from "../config/main.json" assert { type: "json" };
@@ -95,10 +94,10 @@
}
}
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
async remove(
guild: string,
key: string,
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
value: any,
innerKey?: string | null
) {
diff --git a/src/utils/generateEmojiEmbed.ts b/src/utils/generateEmojiEmbed.ts
index c1de60f..69058ae 100644
--- a/src/utils/generateEmojiEmbed.ts
+++ b/src/utils/generateEmojiEmbed.ts
@@ -11,7 +11,6 @@
_title = "";
_emoji: string | null = null;
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
// This *is* meant to be an accessor rather than a property
override get title() {