diff --git a/src/events/messageEdit.ts b/src/events/messageEdit.ts
index 148cdb7..c83512c 100644
--- a/src/events/messageEdit.ts
+++ b/src/events/messageEdit.ts
@@ -2,15 +2,29 @@
 
 export async function callback(client, oldMessage, newMessage) {
     if (newMessage.author.id === client.user.id) return;
-    const { log, NucleusColors, entry, renderUser, renderDelta, renderNumberDelta, renderChannel } = newMessage.channel.client.logger;
+    const {
+        log,
+        NucleusColors,
+        entry,
+        renderUser,
+        renderDelta,
+        renderNumberDelta,
+        renderChannel
+    } = newMessage.channel.client.logger;
     newMessage.reference = newMessage.reference || {};
     let newContent = newMessage.cleanContent.replaceAll("`", "‘");
     let oldContent = oldMessage.cleanContent.replaceAll("`", "‘");
     let attachmentJump = "";
-    const config = (await client.database.guilds.read(newMessage.guild.id)).logging.attachments.saved[newMessage.channel.id + newMessage.id];
-    if (config) { attachmentJump = ` [[View attachments]](${config})`; }
+    const 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 (!oldMessage.flags.has("CROSSPOSTED") && newMessage.flags.has("CROSSPOSTED")) {
+        if (
+            !oldMessage.flags.has("CROSSPOSTED") &&
+            newMessage.flags.has("CROSSPOSTED")
+        ) {
             const data = {
                 meta: {
                     type: "messageAnnounce",
@@ -25,14 +39,35 @@
                 },
                 list: {
                     messageId: entry(newMessage.id, `\`${newMessage.id}\``),
-                    sentBy: entry(newMessage.author.id, renderUser(newMessage.author)),
-                    sentIn: entry(newMessage.channel.id, renderChannel(newMessage.channel)),
-                    sent: entry(new Date(newMessage.createdTimestamp), renderDelta(new Date(newMessage.createdTimestamp))),
-                    published: entry(new Date(newMessage.editedTimestamp), renderDelta(new Date(newMessage.editedTimestamp))),
-                    mentions: renderNumberDelta(oldMessage.mentions.users.size, newMessage.mentions.users.size),
+                    sentBy: entry(
+                        newMessage.author.id,
+                        renderUser(newMessage.author)
+                    ),
+                    sentIn: entry(
+                        newMessage.channel.id,
+                        renderChannel(newMessage.channel)
+                    ),
+                    sent: entry(
+                        new Date(newMessage.createdTimestamp),
+                        renderDelta(new Date(newMessage.createdTimestamp))
+                    ),
+                    published: entry(
+                        new Date(newMessage.editedTimestamp),
+                        renderDelta(new Date(newMessage.editedTimestamp))
+                    ),
+                    mentions: renderNumberDelta(
+                        oldMessage.mentions.users.size,
+                        newMessage.mentions.users.size
+                    ),
                     attachments: entry(
-                        renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size),
-                        renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size) + attachmentJump
+                        renderNumberDelta(
+                            oldMessage.attachments.size,
+                            newMessage.attachments.size
+                        ),
+                        renderNumberDelta(
+                            oldMessage.attachments.size,
+                            newMessage.attachments.size
+                        ) + attachmentJump
                     )
                 },
                 hidden: {
@@ -42,9 +77,13 @@
             return log(data);
         }
     }
-    if (!newMessage.editedTimestamp) { return; }
-    if (newContent.length > 256) newContent = newContent.substring(0, 253) + "...";
-    if (oldContent.length > 256) oldContent = oldContent.substring(0, 253) + "...";
+    if (!newMessage.editedTimestamp) {
+        return;
+    }
+    if (newContent.length > 256)
+        newContent = newContent.substring(0, 253) + "...";
+    if (oldContent.length > 256)
+        oldContent = oldContent.substring(0, 253) + "...";
     const data = {
         meta: {
             type: "messageUpdate",
@@ -55,24 +94,49 @@
             timestamp: newMessage.editedTimestamp
         },
         separate: {
-            start: (oldContent ? `**Before:**\n\`\`\`\n${oldContent}\n\`\`\`\n` : "**Before:** *Message had no content*\n") +
-                (newContent ? `**After:**\n\`\`\`\n${newContent}\n\`\`\`` : "**After:** *Message had no content*"),
+            start:
+                (oldContent
+                    ? `**Before:**\n\`\`\`\n${oldContent}\n\`\`\`\n`
+                    : "**Before:** *Message had no content*\n") +
+                (newContent
+                    ? `**After:**\n\`\`\`\n${newContent}\n\`\`\``
+                    : "**After:** *Message had no content*"),
             end: `[[Jump to message]](${newMessage.url})`
         },
         list: {
             messageId: entry(newMessage.id, `\`${newMessage.id}\``),
             sentBy: entry(newMessage.author.id, renderUser(newMessage.author)),
-            sentIn: entry(newMessage.channel.id, renderChannel(newMessage.channel)),
-            sent: entry(new Date(newMessage.createdTimestamp), renderDelta(new Date(newMessage.createdTimestamp))),
-            edited: entry(new Date(newMessage.editedTimestamp), renderDelta(new Date(newMessage.editedTimestamp))),
-            mentions: renderNumberDelta(oldMessage.mentions.users.size, newMessage.mentions.users.size),
+            sentIn: entry(
+                newMessage.channel.id,
+                renderChannel(newMessage.channel)
+            ),
+            sent: entry(
+                new Date(newMessage.createdTimestamp),
+                renderDelta(new Date(newMessage.createdTimestamp))
+            ),
+            edited: entry(
+                new Date(newMessage.editedTimestamp),
+                renderDelta(new Date(newMessage.editedTimestamp))
+            ),
+            mentions: renderNumberDelta(
+                oldMessage.mentions.users.size,
+                newMessage.mentions.users.size
+            ),
             attachments: entry(
-                renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size),
-                renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size) + attachmentJump
+                renderNumberDelta(
+                    oldMessage.attachments.size,
+                    newMessage.attachments.size
+                ),
+                renderNumberDelta(
+                    oldMessage.attachments.size,
+                    newMessage.attachments.size
+                ) + attachmentJump
             ),
             repliedTo: entry(
                 newMessage.reference.messageId || null,
-                newMessage.reference.messageId ? `[[Jump to message]](https://discord.com/channels/${newMessage.guild.id}/${newMessage.channel.id}/${newMessage.reference.messageId})` : "None"
+                newMessage.reference.messageId
+                    ? `[[Jump to message]](https://discord.com/channels/${newMessage.guild.id}/${newMessage.channel.id}/${newMessage.reference.messageId})`
+                    : "None"
             )
         },
         hidden: {
@@ -80,4 +144,4 @@
         }
     };
     log(data);
-}
\ No newline at end of file
+}
