I hereby decree that this document shall no longer contain the substring " == ", and hereafter shall be referred to as " === ". This amendment shall take effect immediately.
Signed-off-by: pineafan <pineapplefanyt@gmail.com>
diff --git a/src/events/channelCreate.ts b/src/events/channelCreate.ts
index 2d48255..fa66755 100644
--- a/src/events/channelCreate.ts
+++ b/src/events/channelCreate.ts
@@ -4,8 +4,8 @@
try {
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = channel.client.logger
let auditLog = await getAuditLog(channel.guild, 'CHANNEL_CREATE');
- let audit = auditLog.entries.filter(entry => entry.target.id == channel.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === channel.id).first();
+ if (audit.executor.id === client.user.id) return;
let emoji;
let readableType;
let displayName;
diff --git a/src/events/channelDelete.ts b/src/events/channelDelete.ts
index ffe3eae..25c9ce5 100644
--- a/src/events/channelDelete.ts
+++ b/src/events/channelDelete.ts
@@ -7,8 +7,8 @@
const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = channel.client.logger
let auditLog = await getAuditLog(channel.guild, 'CHANNEL_DELETE');
- let audit = auditLog.entries.filter(entry => entry.target.id == channel.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === channel.id).first();
+ if (audit.executor.id === client.user.id) return;
let emoji;
let readableType;
@@ -49,7 +49,7 @@
deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
deletedBy: entry(audit.executor.id, renderUser(audit.executor))
}
- if (channel.topic != null ?? false) list.topic = entry(channel.topic, `\`\`\`\n${channel.topic.replace('`', "'")}\n\`\`\``);
+ if (channel.topic !== null ?? false) list.topic = entry(channel.topic, `\`\`\`\n${channel.topic.replace('`', "'")}\n\`\`\``);
else delete list.topic;
if (channel.nsfw !== null ?? false) list.nsfw = entry(channel.nsfw, channel.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`);
else delete list.nsfw;
diff --git a/src/events/channelUpdate.ts b/src/events/channelUpdate.ts
index 50a3de1..568af0b 100644
--- a/src/events/channelUpdate.ts
+++ b/src/events/channelUpdate.ts
@@ -8,11 +8,11 @@
let config = await client.memory.readGuildInfo(nc.guild.id);
const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderChannel } = client.logger
- if (nc.parent && (nc.parent.id == config.tickets.category)) return
+ if (nc.parent && (nc.parent.id === config.tickets.category)) return
let auditLog = await getAuditLog(nc.guild, 'CHANNEL_UPDATE');
- let audit = auditLog.entries.filter(entry => entry.target.id == nc.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === nc.id).first();
+ if (audit.executor.id === client.user.id) return;
let emoji:string;
let readableType:string;
@@ -23,8 +23,8 @@
edited: entry(new Date().getTime(), renderDelta(new Date().getTime())),
editedBy: entry(audit.executor.id, renderUser((await nc.guild.members.fetch(audit.executor.id)).user)),
}
- if (oc.name != nc.name) changes["name"] = entry([oc.name, nc.name], `${oc.name} -> ${nc.name}`);
- if (oc.position != nc.position) changes["position"] = entry([oc.position, nc.position], `${oc.position} -> ${nc.position}`);
+ if (oc.name !== nc.name) changes["name"] = entry([oc.name, nc.name], `${oc.name} -> ${nc.name}`);
+ if (oc.position !== nc.position) changes["position"] = entry([oc.position, nc.position], `${oc.position} -> ${nc.position}`);
switch (nc.type) {
case 'GUILD_TEXT': {
@@ -43,9 +43,9 @@
let nsfw = ["", ""]
nsfw[0] = oc.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
nsfw[1] = nc.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
- if (oc.topic != nc.topic) changes["description"] = entry([oc.topic, nc.topic], `\nBefore: ${oldTopic}\nAfter: ${newTopic}`);
- if (oc.nsfw != nc.nsfw) changes["nsfw"] = entry([oc.nsfw, nc.nsfw], `${nsfw[0]} -> ${nsfw[1]}`);
- if (oc.rateLimitPerUser != nc.rateLimitPerUser) changes["rateLimitPerUser"] = entry(
+ if (oc.topic !== nc.topic) changes["description"] = entry([oc.topic, nc.topic], `\nBefore: ${oldTopic}\nAfter: ${newTopic}`);
+ if (oc.nsfw !== nc.nsfw) changes["nsfw"] = entry([oc.nsfw, nc.nsfw], `${nsfw[0]} -> ${nsfw[1]}`);
+ if (oc.rateLimitPerUser !== nc.rateLimitPerUser) changes["rateLimitPerUser"] = entry(
[oc.rateLimitPerUser, nc.rateLimitPerUser],
`${humanizeDuration(oc.rateLimitPerUser * 1000)} -> ${humanizeDuration(nc.rateLimitPerUser * 1000)}`
);
@@ -65,16 +65,16 @@
if (newTopic.length > 256) newTopic = `\`\`\`\n${newTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
else newTopic = `\`\`\`\n${newTopic.replace('`', "'")}\n\`\`\``
} else { newTopic = "None"; }
- if (oc.nsfw != nc.nsfw) changes["nsfw"] = entry([oc.nsfw, nc.nsfw], `${oc.nsfw ? "On" : "Off"} -> ${nc.nsfw ? "On" : "Off"}`);
+ if (oc.nsfw !== nc.nsfw) changes["nsfw"] = entry([oc.nsfw, nc.nsfw], `${oc.nsfw ? "On" : "Off"} -> ${nc.nsfw ? "On" : "Off"}`);
break;
}
case 'GUILD_VOICE': {
emoji = "CHANNEL.VOICE.EDIT";
readableType = "Voice";
displayName = "Voice Channel"
- if (oc.bitrate != nc.bitrate) changes["bitrate"] = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
- if (oc.userLimit != nc.userLimit) changes["maxUsers"] = entry([oc.userLimit, nc.userLimit], `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`);
- if (oc.rtcRegion != nc.rtcRegion) changes["region"] = entry(
+ if (oc.bitrate !== nc.bitrate) changes["bitrate"] = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
+ if (oc.userLimit !== nc.userLimit) changes["maxUsers"] = entry([oc.userLimit, nc.userLimit], `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`);
+ if (oc.rtcRegion !== nc.rtcRegion) changes["region"] = entry(
[oc.rtcRegion, nc.rtcRegion],
`${oc.rtcRegion || "Automatic"} -> ${nc.rtcRegion || "Automatic"}`
);
@@ -93,9 +93,9 @@
if (newTopic.length > 256) newTopic = `\`\`\`\n${newTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
else newTopic = `\`\`\`\n${newTopic.replace('`', "'")}\n\`\`\``
} else { newTopic = "None"; }
- if (oc.bitrate != nc.bitrate) changes["bitrate"] = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
- if (oc.userLimit != nc.userLimit) changes["maxUsers"] = entry([oc.userLimit, nc.userLimit], `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`);
- if (oc.rtcRegion != nc.rtcRegion) changes["region"] = entry(
+ if (oc.bitrate !== nc.bitrate) changes["bitrate"] = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
+ if (oc.userLimit !== nc.userLimit) changes["maxUsers"] = entry([oc.userLimit, nc.userLimit], `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`);
+ if (oc.rtcRegion !== nc.rtcRegion) changes["region"] = entry(
[oc.rtcRegion, nc.rtcRegion],
`${oc.rtcRegion || "Automatic"} -> ${nc.rtcRegion || "Automatic"}`
);
@@ -114,7 +114,7 @@
}
}
let t = oc.type.split("_")[1];
- if (oc.type != nc.type) changes["type"] = entry([oc.type, nc.type], `${t[0] + t.splice(1).toLowerCase()} -> ${readableType}`);
+ if (oc.type !== nc.type) changes["type"] = entry([oc.type, nc.type], `${t[0] + t.splice(1).toLowerCase()} -> ${readableType}`);
if (!(Object.values(changes).length - 4)) return
let data = {
meta:{
diff --git a/src/events/emojiCreate.ts b/src/events/emojiCreate.ts
index 25d1b62..9e91012 100644
--- a/src/events/emojiCreate.ts
+++ b/src/events/emojiCreate.ts
@@ -4,8 +4,8 @@
try {
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger
let auditLog = await getAuditLog(emoji.guild, 'EMOJI_CREATE');
- let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === emoji.id).first();
+ if (audit.executor.id === client.user.id) return;
let data = {
meta: {
type: 'emojiCreate',
diff --git a/src/events/emojiDelete.ts b/src/events/emojiDelete.ts
index 2dcb685..0c39542 100644
--- a/src/events/emojiDelete.ts
+++ b/src/events/emojiDelete.ts
@@ -4,8 +4,8 @@
try{
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger
let auditLog = await getAuditLog(emoji.guild, 'EMOJI_DELETE');
- let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === emoji.id).first();
+ if (audit.executor.id === client.user.id) return;
let data = {
meta: {
type: 'emojiDelete',
diff --git a/src/events/emojiUpdate.ts b/src/events/emojiUpdate.ts
index 79fb171..a90de9a 100644
--- a/src/events/emojiUpdate.ts
+++ b/src/events/emojiUpdate.ts
@@ -6,10 +6,10 @@
try {
const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderEmoji } = client.logger
- if (oe.name == ne.name) return
+ if (oe.name === ne.name) return
let auditLog = await getAuditLog(ne.guild, 'EMOJI_UPDATE');
let audit = auditLog.entries.first();
- if (audit.executor.id == client.user.id) return;
+ if (audit.executor.id === client.user.id) return;
let changes = {
emojiId: entry(ne.id, `\`${ne.id}\``),
diff --git a/src/events/guildBanAdd.ts b/src/events/guildBanAdd.ts
index d095049..06163a9 100644
--- a/src/events/guildBanAdd.ts
+++ b/src/events/guildBanAdd.ts
@@ -9,8 +9,8 @@
try {
const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = ban.user.client.logger
let auditLog = await getAuditLog(ban.guild, 'MEMBER_BAN_ADD')
- let audit = auditLog.entries.filter(entry => entry.target.id == ban.user.id).first();
- if (audit.executor.id == client.user.id) return
+ let audit = auditLog.entries.filter(entry => entry.target.id === ban.user.id).first();
+ if (audit.executor.id === client.user.id) return
try { await client.database.history.create("ban", ban.guild.id, ban.user, audit.executor, audit.reason) } catch {}
let data = {
meta: {
diff --git a/src/events/guildBanRemove.ts b/src/events/guildBanRemove.ts
index 4d6d1f8..2a1b6de 100644
--- a/src/events/guildBanRemove.ts
+++ b/src/events/guildBanRemove.ts
@@ -10,8 +10,8 @@
try {
const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = ban.user.client.logger
let auditLog = await getAuditLog(ban.guild, 'MEMBER_BAN_REMOVE')
- let audit = auditLog.entries.filter(entry => entry.target.id == ban.user.id).first();
- if (audit.executor.id == client.user.id) return
+ let audit = auditLog.entries.filter(entry => entry.target.id === ban.user.id).first();
+ if (audit.executor.id === client.user.id) return
try { await client.database.history.create("unban", ban.guild.id, ban.user, audit.executor, audit.reason) } catch {}
let data = {
meta: {
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index e68aee4..d555647 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -4,9 +4,9 @@
try {
const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = after.client.logger
let auditLog = await getAuditLog(after.guild, 'MEMBER_UPDATE');
- let audit = auditLog.entries.filter(entry => entry.target.id == after.id).first();
- if (audit.executor.id == client.user.id) return;
- if (before.nickname != after.nickname) {
+ let audit = auditLog.entries.filter(entry => entry.target.id === after.id).first();
+ if (audit.executor.id === client.user.id) return;
+ if (before.nickname !== after.nickname) {
try { await client.database.history.create(
"nickname", after.guild.id, after.user, audit.executor,
null, before.nickname || before.user.username, after.nickname || after.user.username) } catch {}
diff --git a/src/events/guildUpdate.ts b/src/events/guildUpdate.ts
index ee02b66..e27975b 100644
--- a/src/events/guildUpdate.ts
+++ b/src/events/guildUpdate.ts
@@ -1,11 +1,14 @@
+import { callback as statsChannelUpdate } from '../reflex/statsChannelUpdate.js';
+
export const event = 'guildUpdate'
export async function callback(client, before, after) {
+ try { await statsChannelUpdate(client, after.me); } catch(e) { console.log(e)}
try {
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = after.client.logger
let auditLog = await getAuditLog(after, 'GUILD_UPDATE');
- let audit = auditLog.entries.filter(entry => entry.target.id == after.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === after.id).first();
+ if (audit.executor.id === client.user.id) return;
let list = {}
const verificationLevels = {
@@ -27,14 +30,14 @@
ELEVATED: 'Enabled'
}
- if (before.name != after.name) list["name"] = entry([before.name, after.name], `${before.name} -> ${after.name}`);
- if (before.icon != after.icon) list["icon"] = entry([before.icon, after.icon], `[Before](${before.iconURL()}) -> [After](${after.iconURL()})`);
- if (before.splash != after.splash) list["splash"] = entry([before.splash, after.splash], `[Before](${before.splashURL()}) -> [After](${after.splashURL()})`);
- if (before.banner != after.banner) list["banner"] = entry([before.banner, after.banner], `[Before](${before.bannerURL()}) -> [After](${after.bannerURL()})`);
- if (before.owner != after.owner) list["owner"] = entry([before.owner, after.owner], `${renderUser(before.owner.user)} -> ${renderUser(after.owner.user)}`);
- if (before.verificationLevel != after.verificationLevel) list["verificationLevel"] = entry([verificationLevels[before.verificationLevel], verificationLevels[after.verificationLevel]], `${verificationLevels[before.verificationLevel]} -> ${verificationLevels[after.verificationLevel]}`);
- if (before.explicitContentFilter != after.explicitContentFilter) list["explicitContentFilter"] = entry([explicitContentFilterLevels[before.explicitContentFilter], explicitContentFilterLevels[after.explicitContentFilter]], `${explicitContentFilterLevels[before.explicitContentFilter]} -> ${explicitContentFilterLevels[after.explicitContentFilter]}`);
- if (before.mfaLevel != after.mfaLevel) list["2 factor authentication"] = entry([MFALevels[before.mfaLevel], MFALevels[after.mfaLevel]], `${MFALevels[before.mfaLevel]} -> ${MFALevels[after.mfaLevel]}`);
+ if (before.name !== after.name) list["name"] = entry([before.name, after.name], `${before.name} -> ${after.name}`);
+ if (before.icon !== after.icon) list["icon"] = entry([before.icon, after.icon], `[Before](${before.iconURL()}) -> [After](${after.iconURL()})`);
+ if (before.splash !== after.splash) list["splash"] = entry([before.splash, after.splash], `[Before](${before.splashURL()}) -> [After](${after.splashURL()})`);
+ if (before.banner !== after.banner) list["banner"] = entry([before.banner, after.banner], `[Before](${before.bannerURL()}) -> [After](${after.bannerURL()})`);
+ if (before.owner !== after.owner) list["owner"] = entry([before.owner, after.owner], `${renderUser(before.owner.user)} -> ${renderUser(after.owner.user)}`);
+ if (before.verificationLevel !== after.verificationLevel) list["verificationLevel"] = entry([verificationLevels[before.verificationLevel], verificationLevels[after.verificationLevel]], `${verificationLevels[before.verificationLevel]} -> ${verificationLevels[after.verificationLevel]}`);
+ if (before.explicitContentFilter !== after.explicitContentFilter) list["explicitContentFilter"] = entry([explicitContentFilterLevels[before.explicitContentFilter], explicitContentFilterLevels[after.explicitContentFilter]], `${explicitContentFilterLevels[before.explicitContentFilter]} -> ${explicitContentFilterLevels[after.explicitContentFilter]}`);
+ if (before.mfaLevel !== after.mfaLevel) list["2 factor authentication"] = entry([MFALevels[before.mfaLevel], MFALevels[after.mfaLevel]], `${MFALevels[before.mfaLevel]} -> ${MFALevels[after.mfaLevel]}`);
if (!(Object.keys(list).length)) return;
list["updated"] = entry(new Date().getTime(), renderDelta(new Date().getTime()))
diff --git a/src/events/inviteCreate.ts b/src/events/inviteCreate.ts
index 5081dd1..5d47bf8 100644
--- a/src/events/inviteCreate.ts
+++ b/src/events/inviteCreate.ts
@@ -5,8 +5,8 @@
try {
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = invite.client.logger
let auditLog = await getAuditLog(invite.guild, 'INVITE_CREATE');
- let audit = auditLog.entries.filter(entry => entry.target.id == invite.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === invite.id).first();
+ if (audit.executor.id === client.user.id) return;
let data = {
meta: {
type: 'inviteCreate',
diff --git a/src/events/inviteDelete.ts b/src/events/inviteDelete.ts
index b6ddd22..acfc9dd 100644
--- a/src/events/inviteDelete.ts
+++ b/src/events/inviteDelete.ts
@@ -5,8 +5,8 @@
try {
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = invite.client.logger
let auditLog = await getAuditLog(invite.guild, 'INVITE_DELETE');
- let audit = auditLog.entries.filter(entry => entry.target.id == invite.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === invite.id).first();
+ if (audit.executor.id === client.user.id) return;
let data = {
meta: {
type: 'inviteDelete',
diff --git a/src/events/memberLeave.ts b/src/events/memberLeave.ts
index 122e01a..5dff86f 100644
--- a/src/events/memberLeave.ts
+++ b/src/events/memberLeave.ts
@@ -1,4 +1,3 @@
-import humanizeDuration from 'humanize-duration';
import { purgeByUser } from '../actions/tickets/delete.js';
import { callback as statsChannelRemove } from '../reflex/statsChannelUpdate.js';
@@ -6,10 +5,11 @@
export async function callback(client, member) {
try { purgeByUser(member.id, member.guild); } catch {}
+ try { await statsChannelRemove(client, member); } catch {}
try {
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger
let auditLog = await getAuditLog(member.guild, 'MEMBER_KICK');
- let audit = auditLog.entries.filter(entry => entry.target.id == member.id).first();
+ let audit = auditLog.entries.filter(entry => entry.target.id === member.id).first();
let type = "leave"
if (audit) {
if (audit.executor.id === client.user.id) return
@@ -18,7 +18,7 @@
}
}
let data
- if (type == "kick") {
+ if (type === "kick") {
try { await client.database.history.create("kick", member.guild.id, member.user, audit.executor, audit.reason) } catch {}
data = {
meta: {
@@ -36,7 +36,6 @@
kicked: entry(new Date().getTime(), renderDelta(new Date().getTime())),
kickedBy: entry(audit.executor.id, renderUser(audit.executor)),
reason: entry(audit.reason, audit.reason ? `\n> ${audit.reason}` : "*No reason provided.*"),
- timeInServer: entry(new Date().getTime() - member.joinedAt, humanizeDuration(new Date().getTime() - member.joinedAt, { round: true })),
accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
serverMemberCount: member.guild.memberCount,
},
@@ -60,7 +59,6 @@
name: entry(member.id, renderUser(member.user)),
joined: entry(member.joinedTimestamp, renderDelta(member.joinedAt)),
left: entry(new Date().getTime(), renderDelta(new Date().getTime())),
- timeInServer: entry(new Date().getTime() - member.joinedTimestamp, humanizeDuration(new Date().getTime() - member.joinedAt, { round: true })),
accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
serverMemberCount: member.guild.memberCount,
},
@@ -71,5 +69,4 @@
}
log(data);
} catch (e) { console.log(e) }
- try { await statsChannelRemove(client, member); } catch {}
}
diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts
index dce1959..cbb1fa2 100644
--- a/src/events/messageCreate.ts
+++ b/src/events/messageCreate.ts
@@ -1,14 +1,17 @@
import { LinkCheck, MalwareCheck, NSFWCheck, SizeCheck, TestString, TestImage } from '../reflex/scanners.js'
import logAttachment from '../premium/attachmentLogs.js'
import createLogException from '../utils/createLogException.js'
-import getEmojiByName from '../utils/getEmojiByName.js'
+import getEmojiByName from '../utils/getEmojiByName.js';
+import client from '../utils/client.js';
+import {callback as a} from '../reflex/statsChannelUpdate.js'
export const event = 'messageCreate'
-export async function callback(client, message) {
+export async function callback(_, message) {
if(!message) return;
if (message.author.bot) return
if (message.channel.type === 'dm') return
+ try { await a(client, await message.guild.members.fetch(message.author.id)); } catch(e) { console.log(e)}
const { log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger
@@ -66,7 +69,7 @@
for (let element of fileNames.files) {
if(!message) return;
let url = element.url ? element.url : element.local
- if (url != undefined) {
+ if (url !== undefined) {
if(/\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/.test(url)) {
if (config.filters.images.NSFW && !message.channel.nsfw) {
if (await NSFWCheck(url)) {
@@ -94,30 +97,28 @@
}
if (config.filters.wordFilter.enabled) {
let text = await TestImage(url)
- if (config.filters.wordFilter.enabled) {
- let 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()
- let 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
- }
+ let 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()
+ let 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);
}
+ return log(data);
}
}
if (config.filters.images.size) {
@@ -199,6 +200,7 @@
}
return log(data);
}
+
if (config.filters.wordFilter.enabled) {
let check = TestString(content, config.filters.wordFilter.words.loose, config.filters.wordFilter.words.strict)
if(check !== null) {
@@ -225,78 +227,73 @@
}
}
- if (!config.filters.pings.allowed.users.includes(message.author.id) ||
- !config.filters.pings.allowed.channels.includes(message.channel.id) ||
- !message.author.roles.cache.some(role => config.filters.pings.allowed.roles.includes(role.id))
- ) {
- if (config.filters.pings.everyone && message.mentions.everyone) {
- let data = {
- meta: {
- type: 'everyonePing',
- displayName: 'Everyone Pinged',
- calculateType: 'messageMassPing',
- color: NucleusColors.yellow,
- emoji: 'MESSAGE.PING.EVERYONE',
- timestamp: new Date().getTime()
- },
- separate: {
- start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
- },
- list: list,
- hidden: {
- guild: message.channel.guild.id
- }
+ if (config.filters.pings.everyone && message.mentions.everyone) {
+ let data = {
+ meta: {
+ type: 'everyonePing',
+ displayName: 'Everyone Pinged',
+ calculateType: 'messageMassPing',
+ color: NucleusColors.yellow,
+ emoji: 'MESSAGE.PING.EVERYONE',
+ timestamp: new Date().getTime()
+ },
+ separate: {
+ start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
+ },
+ list: list,
+ hidden: {
+ guild: message.channel.guild.id
}
- return log(data);
}
- if (config.filters.pings.roles) {
- for(let role of message.mentions.roles) {
- if(!message) return;
- if (!config.filters.pings.allowed.roles.includes(role.id)) {
- createLogException(message.guild.id, message.channel.id, message.id)
- await message.delete()
- let data = {
- meta: {
- type: 'rolePing',
- displayName: 'Role Pinged',
- calculateType: 'messageMassPing',
- color: NucleusColors.yellow,
- emoji: 'MESSAGE.PING.ROLE',
- timestamp: new Date().getTime()
- },
- separate: {
- start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
- },
- list: list,
- hidden: {
- guild: message.channel.guild.id
- }
+ return log(data);
+ }
+ if (config.filters.pings.roles) {
+ for(let role of message.mentions.roles) {
+ if(!message) return;
+ if (!config.filters.pings.allowed.roles.includes(role.id)) {
+ createLogException(message.guild.id, message.channel.id, message.id)
+ await message.delete()
+ let data = {
+ meta: {
+ type: 'rolePing',
+ displayName: 'Role Pinged',
+ calculateType: 'messageMassPing',
+ color: NucleusColors.yellow,
+ emoji: 'MESSAGE.PING.ROLE',
+ timestamp: new Date().getTime()
+ },
+ separate: {
+ start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
+ },
+ list: list,
+ hidden: {
+ guild: message.channel.guild.id
}
- return log(data);
}
+ return log(data);
}
}
- if (message.mentions.users.size >= config.filters.pings.mass && config.filters.pings.mass) {
- createLogException(message.guild.id, message.channel.id, message.id)
- await message.delete()
- let data = {
- meta: {
- type: 'massPing',
- displayName: `Mass Ping`,
- calculateType: 'messageMassPing',
- color: NucleusColors.yellow,
- emoji: 'MESSAGE.PING.MASS',
- timestamp: new Date().getTime()
- },
- separate: {
- start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
- },
- list: list,
- hidden: {
- guild: message.channel.guild.id
- }
+ }
+ if (message.mentions.users.size >= config.filters.pings.mass && config.filters.pings.mass) {
+ createLogException(message.guild.id, message.channel.id, message.id)
+ await message.delete()
+ let data = {
+ meta: {
+ type: 'massPing',
+ displayName: `Mass Ping`,
+ calculateType: 'messageMassPing',
+ color: NucleusColors.yellow,
+ emoji: 'MESSAGE.PING.MASS',
+ timestamp: new Date().getTime()
+ },
+ separate: {
+ start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
+ },
+ list: list,
+ hidden: {
+ guild: message.channel.guild.id
}
- return log(data);
}
+ return log(data);
}
}
diff --git a/src/events/messageDelete.ts b/src/events/messageDelete.ts
index 3c23739..b139297 100644
--- a/src/events/messageDelete.ts
+++ b/src/events/messageDelete.ts
@@ -2,11 +2,11 @@
export async function callback(client, message) {
try {
- if (message.author.id == client.user.id) return;
+ if (message.author.id === client.user.id) return;
if (client.noLog.includes(`${message.guild.id}/${message.channel.id}/${message.id}`)) return;
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = message.channel.client.logger
let auditLog = await getAuditLog(message.guild, 'MEMBER_BAN_ADD')
- let audit = auditLog.entries.filter(entry => entry.target.id == message.author.id).first();
+ let audit = auditLog.entries.filter(entry => entry.target.id === message.author.id).first();
if (audit) {
if (audit.createdAt - 100 < new Date().getTime()) return;
}
diff --git a/src/events/messageEdit.ts b/src/events/messageEdit.ts
index 5e63797..9e0e521 100644
--- a/src/events/messageEdit.ts
+++ b/src/events/messageEdit.ts
@@ -2,7 +2,7 @@
export async function callback(client, oldMessage, newMessage) {
try {
- if (newMessage.author.id == client.user.id) return;
+ if (newMessage.author.id === client.user.id) return;
const { log, NucleusColors, entry, renderUser, renderDelta, renderNumberDelta, renderChannel } = newMessage.channel.client.logger
newMessage.reference = newMessage.reference || {}
let newContent = newMessage.cleanContent.replaceAll("`", "‘")
@@ -10,7 +10,7 @@
let attachmentJump = "";
let config = (await client.database.guilds.read(newMessage.guild.id)).logging.attachments.saved[newMessage.channel.id + newMessage.id];
if (config) { attachmentJump = ` [[View attachments]](${config})` }
- if (newContent == oldContent) {
+ if (newContent === oldContent) {
if (!oldMessage.flags.has("CROSSPOSTED") && newMessage.flags.has("CROSSPOSTED")) {
let data = {
meta: {
diff --git a/src/events/roleCreate.ts b/src/events/roleCreate.ts
index 6fded26..2f159ac 100644
--- a/src/events/roleCreate.ts
+++ b/src/events/roleCreate.ts
@@ -5,8 +5,8 @@
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderRole } = role.client.logger
if (role.managed) return;
let auditLog = await getAuditLog(role.guild, 'ROLE_CREATE');
- let audit = auditLog.entries.filter(entry => entry.target.id == role.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === role.id).first();
+ if (audit.executor.id === client.user.id) return;
let data = {
meta: {
type: 'roleCreate',
diff --git a/src/events/roleDelete.ts b/src/events/roleDelete.ts
index 6a23d9e..3b43a55 100644
--- a/src/events/roleDelete.ts
+++ b/src/events/roleDelete.ts
@@ -7,8 +7,8 @@
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = role.client.logger
if (role.managed) return;
let auditLog = await getAuditLog(role.guild, 'ROLE_DELETE');
- let audit = auditLog.entries.filter(entry => entry.target.id == role.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === role.id).first();
+ if (audit.executor.id === client.user.id) return;
let data = {
meta: {
type: 'roleDelete',
diff --git a/src/events/roleUpdate.ts b/src/events/roleUpdate.ts
index 7c6ca75..7c03c97 100644
--- a/src/events/roleUpdate.ts
+++ b/src/events/roleUpdate.ts
@@ -8,7 +8,7 @@
let auditLog = await getAuditLog(nr.guild, 'ROLE_UPDATE');
let audit = auditLog.entries.first();
- if (audit.executor.id == client.user.id) return;
+ if (audit.executor.id === client.user.id) return;
let changes = {
roleId: entry(nr.id, `\`${nr.id}\``),
@@ -22,13 +22,13 @@
mentionable[1] = nr.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
hoist[0] = or.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
hoist[1] = nr.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
- if (or.name != nr.name) changes["name"] = entry([or.name, nr.name], `${or.name} -> ${nr.name}`);
- if (or.position != nr.position) changes["position"] = entry([or.position, nr.position], `${or.position} -> ${nr.position}`);
- if (or.hoist != nr.hoist) changes["showInMemberList"] = entry([or.hoist, nr.hoist], `${hoist[0]} -> ${hoist[1]}`);
- if (or.mentionable != nr.mentionable) changes["mentionable"] = entry([or.mentionable, nr.mentionable], `${mentionable[0]} -> ${mentionable[1]}`);
- if (or.hexColor != nr.hexColor) changes["color"] = entry([or.hexColor, nr.hexColor], `\`${or.hexColor}\` -> \`${nr.hexColor}\``);
+ if (or.name !== nr.name) changes["name"] = entry([or.name, nr.name], `${or.name} -> ${nr.name}`);
+ if (or.position !== nr.position) changes["position"] = entry([or.position, nr.position], `${or.position} -> ${nr.position}`);
+ if (or.hoist !== nr.hoist) changes["showInMemberList"] = entry([or.hoist, nr.hoist], `${hoist[0]} -> ${hoist[1]}`);
+ if (or.mentionable !== nr.mentionable) changes["mentionable"] = entry([or.mentionable, nr.mentionable], `${mentionable[0]} -> ${mentionable[1]}`);
+ if (or.hexColor !== nr.hexColor) changes["color"] = entry([or.hexColor, nr.hexColor], `\`${or.hexColor}\` -> \`${nr.hexColor}\``);
- if (Object.keys(changes).length == 4) return
+ if (Object.keys(changes).length === 4) return
let data = {
meta:{
diff --git a/src/events/stickerCreate.ts b/src/events/stickerCreate.ts
index b9511b0..669de32 100644
--- a/src/events/stickerCreate.ts
+++ b/src/events/stickerCreate.ts
@@ -4,8 +4,8 @@
try {
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = emoji.client.logger
let auditLog = await getAuditLog(emoji.guild, 'STICKER_CREATE');
- let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === emoji.id).first();
+ if (audit.executor.id === client.user.id) return;
let data = {
meta: {
type: 'stickerCreate',
diff --git a/src/events/stickerDelete.ts b/src/events/stickerDelete.ts
index 7490851..0431bda 100644
--- a/src/events/stickerDelete.ts
+++ b/src/events/stickerDelete.ts
@@ -4,8 +4,8 @@
try{
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = emoji.client.logger
let auditLog = await getAuditLog(emoji.guild, 'STICKER_DELETE');
- let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === emoji.id).first();
+ if (audit.executor.id === client.user.id) return;
let data = {
meta: {
type: 'stickerDelete',
diff --git a/src/events/stickerUpdate.ts b/src/events/stickerUpdate.ts
index 7cb745f..363e072 100644
--- a/src/events/stickerUpdate.ts
+++ b/src/events/stickerUpdate.ts
@@ -4,10 +4,10 @@
try {
const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderEmoji } = client.logger
- if (oe.name == ne.name) return
+ if (oe.name === ne.name) return
let auditLog = await getAuditLog(ne.guild, 'EMOJI_UPDATE');
let audit = auditLog.entries.first();
- if (audit.executor.id == client.user.id) return;
+ if (audit.executor.id === client.user.id) return;
let changes = {
stickerId:entry(ne.id, `\`${ne.id}\``),
diff --git a/src/events/threadCreate.ts b/src/events/threadCreate.ts
index ff69e35..ef7246d 100644
--- a/src/events/threadCreate.ts
+++ b/src/events/threadCreate.ts
@@ -5,8 +5,8 @@
try {
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = thread.client.logger
let auditLog = await getAuditLog(thread.guild, 'THREAD_CREATE');
- let audit = auditLog.entries.filter(entry => entry.target.id == thread.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === thread.id).first();
+ if (audit.executor.id === client.user.id) return;
let data = {
meta: {
type: 'channelCreate',
diff --git a/src/events/threadDelete.ts b/src/events/threadDelete.ts
index 14c5820..9574826 100644
--- a/src/events/threadDelete.ts
+++ b/src/events/threadDelete.ts
@@ -5,8 +5,8 @@
try {
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = thread.client.logger
let auditLog = await getAuditLog(thread.guild, 'THREAD_UPDATE');
- let audit = auditLog.entries.filter(entry => entry.target.id == thread.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === thread.id).first();
+ if (audit.executor.id === client.user.id) return;
let data = {
meta: {
type: 'channelDelete',
diff --git a/src/events/threadUpdate.ts b/src/events/threadUpdate.ts
index 4e13193..8550ffe 100644
--- a/src/events/threadUpdate.ts
+++ b/src/events/threadUpdate.ts
@@ -5,20 +5,20 @@
try {
const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = after.client.logger
let auditLog = await getAuditLog(after.guild, 'THREAD_UPDATE');
- let audit = auditLog.entries.filter(entry => entry.target.id == after.id).first();
- if (audit.executor.id == client.user.id) return;
+ let audit = auditLog.entries.filter(entry => entry.target.id === after.id).first();
+ if (audit.executor.id === client.user.id) return;
let list = {
threadId:entry(after.id, `\`${after.id}\``),
thread: entry(after.name, renderChannel(after)),
parentChannel: entry(after.parentId, renderChannel(after.parent)),
}
- if (before.name != after.name) {
+ if (before.name !== after.name) {
list["name"] = entry([before.name, after.name], `${before.name} -> ${after.name}`);
}
- if (before.autoArchiveDuration != after.autoArchiveDuration) {
+ if (before.autoArchiveDuration !== after.autoArchiveDuration) {
list["autoArchiveDuration"] = entry([before.autoArchiveDuration, after.autoArchiveDuration], `${humanizeDuration(before.autoArchiveDuration * 60 * 1000, { round: true })} -> ${humanizeDuration(after.autoArchiveDuration * 60 * 1000, { round: true })}`);
}
- if (before.rateLimitPerUser != after.rateLimitPerUser) {
+ if (before.rateLimitPerUser !== after.rateLimitPerUser) {
list["slowmode"] = entry([before.rateLimitPerUser, after.rateLimitPerUser], `${humanizeDuration(before.rateLimitPerUser * 1000)} -> ${humanizeDuration(after.rateLimitPerUser * 1000)}`);
}
if (!(Object.keys(list).length - 3)) return;
diff --git a/src/events/webhookUpdate.ts b/src/events/webhookUpdate.ts
index 66b1cd0..28768b2 100644
--- a/src/events/webhookUpdate.ts
+++ b/src/events/webhookUpdate.ts
@@ -8,9 +8,9 @@
let auditLogUpdate = getAuditLog(channel.guild, 'WEBHOOK_UPDATE');
let auditLogDelete = getAuditLog(channel.guild, 'WEBHOOK_DELETE');
[auditLogCreate, auditLogUpdate, auditLogDelete] = await Promise.all([auditLogCreate, auditLogUpdate, auditLogDelete]);
- let auditCreate = auditLogCreate.entries.filter(entry => entry.target.channelId == channel.id).first();
- let auditUpdate = auditLogUpdate.entries.filter(entry => entry.target.channelId == channel.id).first();
- let auditDelete = auditLogDelete.entries.filter(entry => entry.target.channelId == channel.id).first();
+ let auditCreate = auditLogCreate.entries.filter(entry => entry.target.channelId === channel.id).first();
+ let auditUpdate = auditLogUpdate.entries.filter(entry => entry.target.channelId === channel.id).first();
+ let auditDelete = auditLogDelete.entries.filter(entry => entry.target.channelId === channel.id).first();
if (!auditCreate && !auditUpdate && !auditDelete) return;
let audit = auditCreate;
let action = "Create";