diff --git a/src/events/messageEdit.ts b/src/events/messageEdit.ts
index c83512c..1470832 100644
--- a/src/events/messageEdit.ts
+++ b/src/events/messageEdit.ts
@@ -2,29 +2,20 @@
 
 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];
+    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",
@@ -39,14 +30,8 @@
                 },
                 list: {
                     messageId: entry(newMessage.id, `\`${newMessage.id}\``),
-                    sentBy: entry(
-                        newMessage.author.id,
-                        renderUser(newMessage.author)
-                    ),
-                    sentIn: entry(
-                        newMessage.channel.id,
-                        renderChannel(newMessage.channel)
-                    ),
+                    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))
@@ -55,19 +40,10 @@
                         new Date(newMessage.editedTimestamp),
                         renderDelta(new Date(newMessage.editedTimestamp))
                     ),
-                    mentions: renderNumberDelta(
-                        oldMessage.mentions.users.size,
-                        newMessage.mentions.users.size
-                    ),
+                    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: {
@@ -80,10 +56,8 @@
     if (!newMessage.editedTimestamp) {
         return;
     }
-    if (newContent.length > 256)
-        newContent = newContent.substring(0, 253) + "...";
-    if (oldContent.length > 256)
-        oldContent = oldContent.substring(0, 253) + "...";
+    if (newContent.length > 256) newContent = newContent.substring(0, 253) + "...";
+    if (oldContent.length > 256) oldContent = oldContent.substring(0, 253) + "...";
     const data = {
         meta: {
             type: "messageUpdate",
@@ -98,39 +72,19 @@
                 (oldContent
                     ? `**Before:**\n\`\`\`\n${oldContent}\n\`\`\`\n`
                     : "**Before:** *Message had no content*\n") +
-                (newContent
-                    ? `**After:**\n\`\`\`\n${newContent}\n\`\`\``
-                    : "**After:** *Message had no content*"),
+                (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,
