diff --git a/src/utils/log.ts b/src/utils/log.ts
index 6baa0a5..fdf17ef 100644
--- a/src/utils/log.ts
+++ b/src/utils/log.ts
@@ -34,9 +34,7 @@
         return `${role.name} [<@&${role.id}>]`;
     }
     renderEmoji(emoji: Discord.GuildEmoji) {
-        return `<${emoji.animated ? "a" : ""}:${emoji.name}:${emoji.id}> [\`:${
-            emoji.name
-        }:\`]`;
+        return `<${emoji.animated ? "a" : ""}:${emoji.name}:${emoji.id}> [\`:${emoji.name}:\`]`;
     }
 
     public readonly NucleusColors = {
@@ -59,17 +57,11 @@
         const config = await client.database.guilds.read(log.hidden.guild);
         if (!config.logging.logs.enabled) return;
         if (!(log.meta.calculateType === true)) {
-            if (
-                !toHexArray(config.logging.logs.toLog).includes(
-                    log.meta.calculateType
-                )
-            )
+            if (!toHexArray(config.logging.logs.toLog).includes(log.meta.calculateType))
                 return console.log("Not logging this type of event");
         }
         if (config.logging.logs.channel) {
-            const channel = (await client.channels.fetch(
-                config.logging.logs.channel
-            )) as Discord.TextChannel | null;
+            const channel = (await client.channels.fetch(config.logging.logs.channel)) as Discord.TextChannel | null;
             const description: Record<string, string> = {};
             Object.entries(log.list).map((entry) => {
                 const key: string = entry[0];
@@ -84,11 +76,7 @@
             if (channel) {
                 log.separate = log.separate || {};
                 const embed = new Discord.MessageEmbed()
-                    .setTitle(
-                        `${getEmojiByName(log.meta.emoji)} ${
-                            log.meta.displayName
-                        }`
-                    )
+                    .setTitle(`${getEmojiByName(log.meta.emoji)} ${log.meta.displayName}`)
                     .setDescription(
                         (log.separate.start ? log.separate.start + "\n" : "") +
                             generateKeyValueList(description) +
