diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index d555647..a7f8c47 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -1,20 +1,20 @@
-export const event = 'guildMemberUpdate'
+export const event = "guildMemberUpdate";
 
 export async function callback(client, before, after) {
     try {
-        const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = after.client.logger
-        let auditLog = await getAuditLog(after.guild, 'MEMBER_UPDATE');
-        let audit = auditLog.entries.filter(entry => entry.target.id === after.id).first();
+        const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = after.client.logger;
+        const auditLog = await getAuditLog(after.guild, "MEMBER_UPDATE");
+        const audit = auditLog.entries.filter(entry => entry.target.id === after.id).first();
         if (audit.executor.id === client.user.id) return;
         if (before.nickname !== after.nickname) {
-            try { await client.database.history.create(
+            await client.database.history.create(
                 "nickname", after.guild.id, after.user, audit.executor,
-                null, before.nickname || before.user.username, after.nickname || after.user.username) } catch {}
-            let data = {
+                null, before.nickname || before.user.username, after.nickname || after.user.username);
+            const data = {
                 meta: {
-                    type: 'memberUpdate',
-                    displayName: 'Nickname Changed',
-                    calculateType: 'guildMemberUpdate',
+                    type: "memberUpdate",
+                    displayName: "Nickname Changed",
+                    calculateType: "guildMemberUpdate",
                     color: NucleusColors.yellow,
                     emoji: "PUNISH.NICKNAME.YELLOW",
                     timestamp: new Date().getTime()
@@ -22,25 +22,25 @@
                 list: {
                     memberId: entry(after.id, `\`${after.id}\``),
                     name: entry(after.user.id, renderUser(after.user)),
-                    before: entry(before.nickname, before.nickname ? before.nickname : '*None*'),
-                    after: entry(after.nickname, after.nickname ? after.nickname : '*None*'),
+                    before: entry(before.nickname, before.nickname ? before.nickname : "*None*"),
+                    after: entry(after.nickname, after.nickname ? after.nickname : "*None*"),
                     changed: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                     changedBy: entry(audit.executor.id, renderUser(audit.executor))
                 },
                 hidden: {
                     guild: after.guild.id
                 }
-            }
+            };
             log(data);
         } else if (before.communicationDisabledUntilTimestamp < new Date().getTime() && after.communicationDisabledUntil > new Date().getTime()) {
-            try { await client.database.history.create(
+            await client.database.history.create(
                 "mute", after.guild.id, after.user, audit.executor, audit.reason, null, null, null
-            )} catch {}
-            let data = {
+            );
+            const data = {
                 meta: {
-                    type: 'memberMute',
-                    displayName: 'Muted',
-                    calculateType: 'guildMemberPunish',
+                    type: "memberMute",
+                    displayName: "Muted",
+                    calculateType: "guildMemberPunish",
                     color: NucleusColors.yellow,
                     emoji: "PUNISH.MUTE.YELLOW",
                     timestamp: new Date().getTime()
@@ -51,12 +51,12 @@
                     mutedUntil: entry(after.communicationDisabledUntilTimestamp, renderDelta(after.communicationDisabledUntilTimestamp)),
                     muted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                     mutedBy: entry(audit.executor.id, renderUser(audit.executor)),
-                    reason: entry(audit.reason, audit.reason ? audit.reason : '\n> *No reason provided*')
+                    reason: entry(audit.reason, audit.reason ? audit.reason : "\n> *No reason provided*")
                 },
                 hidden: {
                     guild: after.guild.id
                 }
-            }
+            };
             log(data);
             client.database.eventScheduler.schedule("naturalUnmute", after.communicationDisabledUntil,
                 {guild: after.guild.id, user: after.id, expires: after.communicationDisabledUntilTimestamp}
@@ -65,14 +65,14 @@
             after.communicationDisabledUntil === null && before.communicationDisabledUntilTimestamp !== null &&
             new Date().getTime() >= audit.createdTimestamp
         ) {
-            try { await client.database.history.create(
+            await client.database.history.create(
                 "unmute", after.guild.id, after.user, audit.executor, null, null, null, null
-            )} catch {}
-            let data = {
+            );
+            const data = {
                 meta: {
-                    type: 'memberUnmute',
-                    displayName: 'Unmuted',
-                    calculateType: 'guildMemberPunish',
+                    type: "memberUnmute",
+                    displayName: "Unmuted",
+                    calculateType: "guildMemberPunish",
                     color: NucleusColors.green,
                     emoji: "PUNISH.MUTE.GREEN",
                     timestamp: new Date().getTime()
@@ -86,9 +86,9 @@
                 hidden: {
                     guild: after.guild.id
                 }
-            }
+            };
             log(data);
             client.database.eventScheduler.cancel("naturalUnmute", {guild: after.guild.id, user: after.id, expires: before.communicationDisabledUntilTimestamp});
         }
-    } catch (e) { console.log(e) }
+    } catch (e) { console.log(e); }
 }
