Fix a bunch of linter errors
diff --git a/src/events/messageDelete.ts b/src/events/messageDelete.ts
index 473fa52..4cdbdb2 100644
--- a/src/events/messageDelete.ts
+++ b/src/events/messageDelete.ts
@@ -3,10 +3,25 @@
export async function callback(client, message) {
try {
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;
+ 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;
const auditLog = await getAuditLog(message.guild, "MEMBER_BAN_ADD");
- const audit = auditLog.entries.filter(entry => entry.target.id === message.author.id).first();
+ const audit = auditLog.entries
+ .filter((entry) => entry.target.id === message.author.id)
+ .first();
if (audit) {
if (audit.createdAt - 100 < new Date().getTime()) return;
}
@@ -14,10 +29,19 @@
let content = message.cleanContent;
content.replace("`", "\\`");
if (content.length > 256) content = content.substring(0, 253) + "...";
- const attachments = message.attachments.size + (message.content.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/gi) ?? []).length;
+ const attachments =
+ message.attachments.size +
+ (
+ message.content.match(
+ /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/gi
+ ) ?? []
+ ).length;
let attachmentJump = "";
- const config = (await client.database.guilds.read(message.guild.id)).logging.attachments.saved[message.channel.id + message.id];
- if (config) { attachmentJump = ` [[View attachments]](${config})`; }
+ const config = (await client.database.guilds.read(message.guild.id))
+ .logging.attachments.saved[message.channel.id + message.id];
+ if (config) {
+ attachmentJump = ` [[View attachments]](${config})`;
+ }
const data = {
meta: {
type: "messageDelete",
@@ -28,18 +52,28 @@
timestamp: new Date().getTime()
},
separate: {
- start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*"
+ start: content
+ ? `**Message:**\n\`\`\`${content}\`\`\``
+ : "**Message:** *Message had no content*"
},
list: {
messageId: entry(message.id, `\`${message.id}\``),
sentBy: entry(message.author.id, renderUser(message.author)),
- sentIn: entry(message.channel.id, renderChannel(message.channel)),
- deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ sentIn: entry(
+ message.channel.id,
+ renderChannel(message.channel)
+ ),
+ deleted: entry(
+ new Date().getTime(),
+ renderDelta(new Date().getTime())
+ ),
mentions: message.mentions.users.size,
attachments: entry(attachments, attachments + attachmentJump),
repliedTo: entry(
message.reference.messageId || null,
- message.reference.messageId ? `[[Jump to message]](https://discord.com/channels/${message.guild.id}/${message.channel.id}/${message.reference.messageId})` : "None"
+ message.reference.messageId
+ ? `[[Jump to message]](https://discord.com/channels/${message.guild.id}/${message.channel.id}/${message.reference.messageId})`
+ : "None"
)
},
hidden: {
@@ -47,5 +81,7 @@
}
};
log(data);
- } catch(e) { console.log(e); }
+ } catch (e) {
+ console.log(e);
+ }
}