diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts
index 129359f..64c1ceb 100644
--- a/src/commands/user/about.ts
+++ b/src/commands/user/about.ts
@@ -9,10 +9,7 @@
     MessageComponentInteraction,
     SelectMenuInteraction
 } from "discord.js";
-import {
-    SelectMenuOption,
-    SlashCommandSubcommandBuilder
-} from "@discordjs/builders";
+import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
 import generateKeyValueList from "../../utils/generateKeyValueList.js";
@@ -24,11 +21,7 @@
         .setName("about")
         .setDescription("Shows info about a user")
         .addUserOption((option) =>
-            option
-                .setName("user")
-                .setDescription(
-                    "The user to get info about | Default: Yourself"
-                )
+            option.setName("user").setDescription("The user to get info about | Default: Yourself")
         );
 
 class Embed {
@@ -57,8 +50,7 @@
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     if (!interaction.guild) return;
     const { renderUser, renderDelta } = client.logger;
-    const member = (interaction.options.getMember("user") ??
-        interaction.member) as Discord.GuildMember;
+    const member = (interaction.options.getMember("user") ?? interaction.member) as Discord.GuildMember;
     const flags: string[] = [];
     if (
         [
@@ -72,9 +64,7 @@
     }
     if (
         (await client.guilds.cache.get("684492926528651336")?.members.fetch())
-            ?.filter((m: GuildMember) =>
-                m.roles.cache.has("760896837866749972")
-            )
+            ?.filter((m: GuildMember) => m.roles.cache.has("760896837866749972"))
             ?.map((m: GuildMember) => m.id)
             .includes(member.user.id)
     ) {
@@ -115,9 +105,7 @@
     });
     const joinPos = membersArray.findIndex((m) => m.id === member.user.id);
 
-    const roles = member.roles.cache
-        .filter((r) => r.id !== interaction.guild!.id)
-        .sort();
+    const roles = member.roles.cache.filter((r) => r.id !== interaction.guild!.id).sort();
     let s = "";
     let count = 0;
     let ended = false;
@@ -149,12 +137,8 @@
         MENTION_EVERYONE: "Mention Everyone"
     };
     Object.keys(permsArray).map((perm) => {
-        const hasPerm = member.permissions.has(
-            perm as Discord.PermissionString
-        );
-        perms += `${getEmojiByName(
-            "CONTROL." + (hasPerm ? "TICK" : "CROSS")
-        )} ${permsArray[perm]}\n`;
+        const hasPerm = member.permissions.has(perm as Discord.PermissionString);
+        perms += `${getEmojiByName("CONTROL." + (hasPerm ? "TICK" : "CROSS"))} ${permsArray[perm]}\n`;
     });
 
     let selectPaneOpen = false;
@@ -170,11 +154,7 @@
                         flags
                             .map((flag) => {
                                 if (nameReplacements[flag]) {
-                                    return (
-                                        getEmojiByName(`BADGES.${flag}`) +
-                                        " " +
-                                        nameReplacements[flag]
-                                    );
+                                    return getEmojiByName(`BADGES.${flag}`) + " " + nameReplacements[flag];
                                 }
                             })
                             .join("\n") +
@@ -183,26 +163,16 @@
                                 member: renderUser(member.user),
                                 nickname: member.nickname || "*None set*",
                                 id: `\`${member.id}\``,
-                                "joined the server": renderDelta(
-                                    member.joinedTimestamp
-                                ),
-                                "joined discord": renderDelta(
-                                    member.user.createdTimestamp
-                                ),
+                                "joined the server": renderDelta(member.joinedTimestamp),
+                                "joined discord": renderDelta(member.user.createdTimestamp),
                                 "boost status": member.premiumSince
-                                    ? `Started boosting ${renderDelta(
-                                          member.premiumSinceTimestamp
-                                      )}`
+                                    ? `Started boosting ${renderDelta(member.premiumSinceTimestamp)}`
                                     : "*Not boosting*",
                                 "join position": `${joinPos + 1}`
                             })
                     )
-                    .setThumbnail(
-                        member.user.displayAvatarURL({ dynamic: true })
-                    )
-                    .setImage(
-                        (await member.user.fetch()).bannerURL({ format: "gif" })
-                    )
+                    .setThumbnail(member.user.displayAvatarURL({ dynamic: true }))
+                    .setImage((await member.user.fetch()).bannerURL({ format: "gif" }))
             )
             .setTitle("General")
             .setDescription("General information about the user")
@@ -223,9 +193,7 @@
                             (s.length > 0 ? s : "*None*") +
                             "\n"
                     )
-                    .setThumbnail(
-                        member.user.displayAvatarURL({ dynamic: true })
-                    )
+                    .setThumbnail(member.user.displayAvatarURL({ dynamic: true }))
             )
             .setTitle("Roles")
             .setDescription("Roles the user has")
@@ -244,9 +212,7 @@
                             "\n" +
                             perms
                     )
-                    .setThumbnail(
-                        member.user.displayAvatarURL({ dynamic: true })
-                    )
+                    .setThumbnail(member.user.displayAvatarURL({ dynamic: true }))
             )
             .setTitle("Key Permissions")
             .setDescription("Key permissions the user has")
@@ -261,9 +227,7 @@
     let breakReason = "";
     while (true) {
         const em = new Discord.MessageEmbed(embeds[page].embed);
-        em.setDescription(
-            em.description + "\n" + createPageIndicator(embeds.length, page)
-        );
+        em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page));
         let selectPane = [];
 
         if (selectPaneOpen) {
@@ -324,23 +288,15 @@
         if ((i.component as MessageActionRowComponent).customId === "left") {
             if (page > 0) page--;
             selectPaneOpen = false;
-        } else if (
-            (i.component as MessageActionRowComponent).customId === "right"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "right") {
             if (page < embeds.length - 1) page++;
             selectPaneOpen = false;
-        } else if (
-            (i.component as MessageActionRowComponent).customId === "select"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "select") {
             selectPaneOpen = !selectPaneOpen;
-        } else if (
-            (i.component as MessageActionRowComponent).customId === "close"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "close") {
             breakReason = "Message closed";
             break;
-        } else if (
-            (i.component as MessageActionRowComponent).customId === "page"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "page") {
             page = parseInt((i as SelectMenuInteraction).values[0]);
             selectPaneOpen = false;
         } else {
@@ -349,13 +305,7 @@
         }
     }
     const em = new Discord.MessageEmbed(embeds[page].embed);
-    em.setDescription(
-        em.description +
-            "\n" +
-            createPageIndicator(embeds.length, page) +
-            " | " +
-            breakReason
-    );
+    em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page) + " | " + breakReason);
     await interaction.editReply({
         embeds: [em],
         components: [
