diff --git a/src/events/roleUpdate.ts b/src/events/roleUpdate.ts
index c51a9b3..be276e5 100644
--- a/src/events/roleUpdate.ts
+++ b/src/events/roleUpdate.ts
@@ -3,7 +3,15 @@
 export const event = "roleUpdate";
 
 export async function callback(client, or, nr) {
-    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderRole } = client.logger;
+    const {
+        getAuditLog,
+        log,
+        NucleusColors,
+        entry,
+        renderDelta,
+        renderUser,
+        renderRole
+    } = client.logger;
 
     const auditLog = await getAuditLog(nr.guild, "ROLE_UPDATE");
     const audit = auditLog.entries.first();
@@ -13,24 +21,52 @@
         roleId: entry(nr.id, `\`${nr.id}\``),
         role: entry(nr.id, renderRole(nr)),
         edited: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-        editedBy: entry(audit.executor.id, renderUser((await nr.guild.members.fetch(audit.executor.id)).user))
+        editedBy: entry(
+            audit.executor.id,
+            renderUser((await nr.guild.members.fetch(audit.executor.id)).user)
+        )
     };
     const mentionable = ["", ""];
     const hoist = ["", ""];
-    mentionable[0] = or.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
-    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}\``);
+    mentionable[0] = or.mentionable
+        ? `${getEmojiByName("CONTROL.TICK")} Yes`
+        : `${getEmojiByName("CONTROL.CROSS")} No`;
+    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 (Object.keys(changes).length === 4) return;
 
     const data = {
-        meta:{
+        meta: {
             type: "roleUpdate",
             displayName: "Role Edited",
             calculateType: "guildRoleUpdate",
@@ -44,4 +80,4 @@
         }
     }; // TODO: show perms changed (webpage)
     log(data);
-}
\ No newline at end of file
+}
