worked on NSFW Image testing
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index 537a483..fe11ee1 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -93,7 +93,7 @@
if (!auditLog) return;
if (auditLog.executor!.id === client.user!.id) return;
if (before.nickname !== after.nickname) {
- await doMemberChecks(after, after.guild);
+ await doMemberChecks(after);
await client.database.history.create(
"nickname",
after.guild.id,
@@ -125,6 +125,7 @@
};
await log(data);
}
+ if (before.displayAvatarURL !== after.displayAvatarURL) await doMemberChecks(after);
if (
(before.communicationDisabledUntilTimestamp ?? 0) < Date.now() &&
new Date(after.communicationDisabledUntil ?? 0).getTime() > Date.now()
diff --git a/src/events/memberJoin.ts b/src/events/memberJoin.ts
index b01eb60..55f9ba8 100644
--- a/src/events/memberJoin.ts
+++ b/src/events/memberJoin.ts
@@ -9,7 +9,7 @@
export async function callback(client: NucleusClient, member: GuildMember) {
await welcome(member);
await statsChannelAdd(member.user, member.guild);
- await doMemberChecks(member, member.guild);
+ await doMemberChecks(member);
const { log, isLogging, NucleusColors, entry, renderUser, renderDelta } = client.logger;
if (!(await isLogging(member.guild.id, "guildMemberUpdate"))) return;
await client.database.history.create("join", member.guild.id, member.user, null, null);
diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts
index 5369bf4..38c7674 100644
--- a/src/events/messageCreate.ts
+++ b/src/events/messageCreate.ts
@@ -105,42 +105,42 @@
for (const element of fileNames.files) {
const url = element.url ? element.url : element.local;
if (
- /\.(j(pe?g|fif)|a?png|gifv?|w(eb[mp]|av)|mp([34]|eg-\d)|ogg|avi|h\.26(4|5)|cda)$/.test(
+ /\.(jpg|jpeg|png|apng|gif|gifv|webm|webp|mp4|wav|mp3|ogg|jfif|mpeg-\d|avi|h\.264|h\.265)$/.test(
url.toLowerCase()
)
) {
- // jpg|jpeg|png|apng|gif|gifv|webm|webp|mp4|wav|mp3|ogg|jfif|MPEG-#|avi|h.264|h.265
+ // j(pe?g|fif)|a?png|gifv?|w(eb[mp]|av)|mp([34]|eg-\d)|ogg|avi|h\.26(4|5)
+ // ^no
if (
config.filters.images.NSFW &&
- !(message.channel instanceof ThreadChannel ? message.channel.parent?.nsfw : message.channel.nsfw)
+ !(message.channel instanceof ThreadChannel ? message.channel.parent?.nsfw : message.channel.nsfw) &&
+ (await NSFWCheck(element))
) {
- if (await NSFWCheck(url)) {
- messageException(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: Date.now()
- },
- 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);
- }
+ messageException(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: Date.now()
+ },
+ 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);
@@ -209,34 +209,30 @@
}
}
}
- if (config.filters.malware) {
- if (!(await MalwareCheck(url))) {
- messageException(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: Date.now()
- },
- 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 (config.filters.malware && (await MalwareCheck(url))) {
+ messageException(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: Date.now()
+ },
+ 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);
}
}
}