diff --git a/src/events/memberLeave.ts b/src/events/memberLeave.ts
index 842a48b..d170396 100644
--- a/src/events/memberLeave.ts
+++ b/src/events/memberLeave.ts
@@ -6,9 +6,12 @@
 export async function callback(client, member) {
     purgeByUser(member.id, member.guild);
     await statsChannelRemove(client, member);
-    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } =
+        member.client.logger;
     const auditLog = await getAuditLog(member.guild, "MEMBER_KICK");
-    const audit = auditLog.entries.filter(entry => entry.target.id === member.id).first();
+    const 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 +21,13 @@
     }
     let data;
     if (type === "kick") {
-        await client.database.history.create("kick", member.guild.id, member.user, audit.executor, audit.reason);
+        await client.database.history.create(
+            "kick",
+            member.guild.id,
+            member.user,
+            audit.executor,
+            audit.reason
+        );
         data = {
             meta: {
                 type: "memberKick",
@@ -32,10 +41,21 @@
                 memberId: entry(member.id, `\`${member.id}\``),
                 name: entry(member.id, renderUser(member.user)),
                 joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
-                kicked: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                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.*"),
-                accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
+                reason: entry(
+                    audit.reason,
+                    audit.reason
+                        ? `\n> ${audit.reason}`
+                        : "*No reason provided.*"
+                ),
+                accountCreated: entry(
+                    member.user.createdAt,
+                    renderDelta(member.user.createdAt)
+                ),
                 serverMemberCount: member.guild.memberCount
             },
             hidden: {
@@ -43,7 +63,13 @@
             }
         };
     } else {
-        await client.database.history.create("leave", member.guild.id, member.user, null, null);
+        await client.database.history.create(
+            "leave",
+            member.guild.id,
+            member.user,
+            null,
+            null
+        );
         data = {
             meta: {
                 type: "memberLeave",
@@ -56,9 +82,18 @@
             list: {
                 memberId: entry(member.id, `\`${member.id}\``),
                 name: entry(member.id, renderUser(member.user)),
-                joined: entry(member.joinedTimestamp, renderDelta(member.joinedAt)),
-                left: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-                accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
+                joined: entry(
+                    member.joinedTimestamp,
+                    renderDelta(member.joinedAt)
+                ),
+                left: entry(
+                    new Date().getTime(),
+                    renderDelta(new Date().getTime())
+                ),
+                accountCreated: entry(
+                    member.user.createdAt,
+                    renderDelta(member.user.createdAt)
+                ),
                 serverMemberCount: member.guild.memberCount
             },
             hidden: {
