diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts
index 14ec7e5..b106d61 100644
--- a/src/events/messageCreate.ts
+++ b/src/events/messageCreate.ts
@@ -13,10 +13,11 @@
     if (!message.guild) return;
     const config = await client.memory.readGuildInfo(message.guild.id);
 
-    if (config.autoPublish.enabled 
-        && config.autoPublish.channels.includes(message.channel.id)
-        && message.channel.type === ChannelType.GuildAnnouncement
-        && message.reference === null
+    if (
+        config.autoPublish.enabled &&
+        config.autoPublish.channels.includes(message.channel.id) &&
+        message.channel.type === ChannelType.GuildAnnouncement &&
+        message.reference === null
     ) {
         await message.crosspost();
     }
@@ -34,11 +35,11 @@
     const fileNames = await logAttachment(message);
 
     const content = message.content.toLowerCase() || "";
-    if(config.filters.clean.channels.includes(message.channel.id)) {
-        const memberRoles = message.member!.roles.cache.map(role => role.id);
-        const roleAllow = config.filters.clean.allowed.roles.some(role => memberRoles.includes(role));
+    if (config.filters.clean.channels.includes(message.channel.id)) {
+        const memberRoles = message.member!.roles.cache.map((role) => role.id);
+        const roleAllow = config.filters.clean.allowed.roles.some((role) => memberRoles.includes(role));
         const userAllow = config.filters.clean.allowed.users.includes(message.author.id);
-        if(!roleAllow && !userAllow) return await message.delete();
+        if (!roleAllow && !userAllow) return await message.delete();
     }
 
     const filter = getEmojiByName("ICONS.FILTER");
@@ -94,7 +95,11 @@
     if (fileNames.files.length > 0) {
         for (const element of fileNames.files) {
             const url = element.url ? element.url : element.local;
-            if (/\.(j(pe?g|fif)|a?png|gifv?|w(eb[mp]|av)|mp([34]|eg-\d)|ogg|avi|h\.26(4|5)|cda)$/.test(url.toLowerCase())) {
+            if (
+                /\.(j(pe?g|fif)|a?png|gifv?|w(eb[mp]|av)|mp([34]|eg-\d)|ogg|avi|h\.26(4|5)|cda)$/.test(
+                    url.toLowerCase()
+                )
+            ) {
                 // jpg|jpeg|png|apng|gif|gifv|webm|webp|mp4|wav|mp3|ogg|jfif|MPEG-#|avi|h.264|h.265
                 if (
                     config.filters.images.NSFW &&
@@ -288,7 +293,7 @@
     }
 
     if (config.filters.pings.everyone && message.mentions.everyone) {
-        if(!await isLogging(message.guild.id, "messageMassPing")) return;
+        if (!(await isLogging(message.guild.id, "messageMassPing"))) return;
         const data = {
             meta: {
                 type: "everyonePing",
@@ -313,7 +318,7 @@
             if (!config.filters.pings.allowed.roles.includes(roleId)) {
                 messageException(message.guild.id, message.channel.id, message.id);
                 await message.delete();
-                if(!await isLogging(message.guild.id, "messageMassPing")) return;
+                if (!(await isLogging(message.guild.id, "messageMassPing"))) return;
                 const data = {
                     meta: {
                         type: "rolePing",
@@ -340,7 +345,7 @@
     if (message.mentions.users.size >= config.filters.pings.mass && config.filters.pings.mass) {
         messageException(message.guild.id, message.channel.id, message.id);
         await message.delete();
-        if(!await isLogging(message.guild.id, "messageMassPing")) return;
+        if (!(await isLogging(message.guild.id, "messageMassPing"))) return;
         const data = {
             meta: {
                 type: "massPing",
