diff --git a/src/commands/privacy.ts b/src/commands/privacy.ts
index 8fb6b40..3c36ea1 100644
--- a/src/commands/privacy.ts
+++ b/src/commands/privacy.ts
@@ -1,5 +1,9 @@
 import { LoadingEmbed } from "./../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
+import Discord, {
+    CommandInteraction,
+    MessageActionRow,
+    MessageButton
+} from "discord.js";
 import { SelectMenuOption, SlashCommandBuilder } from "@discordjs/builders";
 import { WrappedCheck } from "jshaiku";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
@@ -10,7 +14,9 @@
 
 const command = new SlashCommandBuilder()
     .setName("privacy")
-    .setDescription("Information and options for you and your server's settings");
+    .setDescription(
+        "Information and options for you and your server's settings"
+    );
 
 class Embed {
     embed: Discord.MessageEmbed;
@@ -18,61 +24,111 @@
     description = "";
     pageId = 0;
     components?: MessageActionRow[] = [];
-    setEmbed(embed: Discord.MessageEmbed) { this.embed = embed; return this; }
-    setTitle(title: string) { this.title = title; return this; }
-    setDescription(description: string) { this.description = description; return this; }
-    setPageId(pageId: number) { this.pageId = pageId; return this; }
-    setComponents(components: MessageActionRow[]) { this.components = components; return this; }
+    setEmbed(embed: Discord.MessageEmbed) {
+        this.embed = embed;
+        return this;
+    }
+    setTitle(title: string) {
+        this.title = title;
+        return this;
+    }
+    setDescription(description: string) {
+        this.description = description;
+        return this;
+    }
+    setPageId(pageId: number) {
+        this.pageId = pageId;
+        return this;
+    }
+    setComponents(components: MessageActionRow[]) {
+        this.components = components;
+        return this;
+    }
 }
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     const pages = [
         new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Nucleus Privacy")
-                .setDescription(
-                    "Nucleus is a bot that naturally needs to store data about servers.\n" +
-                    "We are entirely [open source](https://github.com/ClicksMinutePer/Nucleus), so you can check exactly what we store, and how it works.\n\n" +
-                    "If you are a server administrator, you can view the options page in the dropdown under this message.\n\n" +
-                    "Any questions about Nucleus, how it works and data stored can be asked in [our server](https://discord.gg/bPaNnxe)."
-                )
-                .setEmoji("NUCLEUS.LOGO")
-                .setStatus("Danger")
-            ).setTitle("Welcome").setDescription("General privacy information").setPageId(0),
-        new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Scanners")
-                .setDescription(
-                    "Nucleus uses [unscan](https://unscan.co) to scan links, images and files for malware and other threats.\n" +
-                    "This service's [privacy policy](https://unscan.co/policies) is public, and they \"do not store or sell your data.\""
-                )
-                .setEmoji("NUCLEUS.LOGO")
-                .setStatus("Danger")
-            ).setTitle("Scanners").setDescription("About Unscan").setPageId(1),
-        new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Link scanning and Transcripts")
-                .setDescription(
-                    "**Facebook** - Facebook trackers include data such as your date of birth, and guess your age if not entered, your preferences, who you interact with and more.\n" +
-                    "**AMP** - AMP is a technology that allows websites to be served by Google. This means Google can store and track data, and are pushing this to as many pages as possible.\n\n" +
-                    "Transcripts allow you to store all messages sent in a channel. This could be an issue in some cases, as they are hosted on [Pastebin](https://pastebin.com), so a leaked link could show all messages sent in the channel.\n"
-                )
-                .setEmoji("NUCLEUS.LOGO")
-                .setStatus("Danger")
-            ).setTitle("Link scanning and Transcripts").setDescription("Regarding Facebook and AMP filter types, and ticket transcripts").setPageId(2)
-    ].concat((interaction.member as Discord.GuildMember).permissions.has("ADMINISTRATOR") ? [new Embed()
-        .setEmbed(new EmojiEmbed()
-            .setTitle("Options")
-            .setDescription(
-                "Below are buttons for controlling this servers privacy settings"
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("Nucleus Privacy")
+                    .setDescription(
+                        "Nucleus is a bot that naturally needs to store data about servers.\n" +
+                            "We are entirely [open source](https://github.com/ClicksMinutePer/Nucleus), so you can check exactly what we store, and how it works.\n\n" +
+                            "If you are a server administrator, you can view the options page in the dropdown under this message.\n\n" +
+                            "Any questions about Nucleus, how it works and data stored can be asked in [our server](https://discord.gg/bPaNnxe)."
+                    )
+                    .setEmoji("NUCLEUS.LOGO")
+                    .setStatus("Danger")
             )
-            .setEmoji("NUCLEUS.LOGO")
-            .setStatus("Danger")
-        ).setTitle("Options").setDescription("Options").setPageId(3).setComponents([new MessageActionRow().addComponents([
-            new MessageButton().setLabel("Clear all data").setCustomId("clear-all-data").setStyle("DANGER")
-        ])])
-    ] : []);
-    const m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
+            .setTitle("Welcome")
+            .setDescription("General privacy information")
+            .setPageId(0),
+        new Embed()
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("Scanners")
+                    .setDescription(
+                        "Nucleus uses [unscan](https://unscan.co) to scan links, images and files for malware and other threats.\n" +
+                            'This service\'s [privacy policy](https://unscan.co/policies) is public, and they "do not store or sell your data."'
+                    )
+                    .setEmoji("NUCLEUS.LOGO")
+                    .setStatus("Danger")
+            )
+            .setTitle("Scanners")
+            .setDescription("About Unscan")
+            .setPageId(1),
+        new Embed()
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("Link scanning and Transcripts")
+                    .setDescription(
+                        "**Facebook** - Facebook trackers include data such as your date of birth, and guess your age if not entered, your preferences, who you interact with and more.\n" +
+                            "**AMP** - AMP is a technology that allows websites to be served by Google. This means Google can store and track data, and are pushing this to as many pages as possible.\n\n" +
+                            "Transcripts allow you to store all messages sent in a channel. This could be an issue in some cases, as they are hosted on [Pastebin](https://pastebin.com), so a leaked link could show all messages sent in the channel.\n"
+                    )
+                    .setEmoji("NUCLEUS.LOGO")
+                    .setStatus("Danger")
+            )
+            .setTitle("Link scanning and Transcripts")
+            .setDescription(
+                "Regarding Facebook and AMP filter types, and ticket transcripts"
+            )
+            .setPageId(2)
+    ].concat(
+        (interaction.member as Discord.GuildMember).permissions.has(
+            "ADMINISTRATOR"
+        )
+            ? [
+                  new Embed()
+                      .setEmbed(
+                          new EmojiEmbed()
+                              .setTitle("Options")
+                              .setDescription(
+                                  "Below are buttons for controlling this servers privacy settings"
+                              )
+                              .setEmoji("NUCLEUS.LOGO")
+                              .setStatus("Danger")
+                      )
+                      .setTitle("Options")
+                      .setDescription("Options")
+                      .setPageId(3)
+                      .setComponents([
+                          new MessageActionRow().addComponents([
+                              new MessageButton()
+                                  .setLabel("Clear all data")
+                                  .setCustomId("clear-all-data")
+                                  .setStyle("DANGER")
+                          ])
+                      ])
+              ]
+            : []
+    );
+    const m = await interaction.reply({
+        embeds: LoadingEmbed,
+        fetchReply: true,
+        ephemeral: true
+    });
     let page = 0;
 
     let selectPaneOpen = false;
@@ -83,37 +139,59 @@
 
         if (selectPaneOpen) {
             const options = [];
-            pages.forEach(embed => {
-                options.push(new SelectMenuOption({
-                    label: embed.title,
-                    value: embed.pageId.toString(),
-                    description: embed.description || ""
-                }));
+            pages.forEach((embed) => {
+                options.push(
+                    new SelectMenuOption({
+                        label: embed.title,
+                        value: embed.pageId.toString(),
+                        description: embed.description || ""
+                    })
+                );
             });
-            selectPane = [new MessageActionRow().addComponents([
-                new Discord.MessageSelectMenu()
-                    .addOptions(options)
-                    .setCustomId("page")
-                    .setMaxValues(1)
-                    .setPlaceholder("Choose a page...")
-            ])];
+            selectPane = [
+                new MessageActionRow().addComponents([
+                    new Discord.MessageSelectMenu()
+                        .addOptions(options)
+                        .setCustomId("page")
+                        .setMaxValues(1)
+                        .setPlaceholder("Choose a page...")
+                ])
+            ];
         }
-        const components = selectPane.concat([new MessageActionRow().addComponents([
-            new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(page === 0),
-            new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY").setDisabled(false),
-            new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(page === pages.length - 1)
-        ])]);
+        const components = selectPane.concat([
+            new MessageActionRow().addComponents([
+                new MessageButton()
+                    .setCustomId("left")
+                    .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                    .setStyle("SECONDARY")
+                    .setDisabled(page === 0),
+                new MessageButton()
+                    .setCustomId("select")
+                    .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
+                    .setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY")
+                    .setDisabled(false),
+                new MessageButton()
+                    .setCustomId("right")
+                    .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                    .setStyle("SECONDARY")
+                    .setDisabled(page === pages.length - 1)
+            ])
+        ]);
         const em = new Discord.MessageEmbed(pages[page].embed);
-        em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
-        em.setFooter({text: nextFooter ?? ""});
+        em.setDescription(
+            em.description + "\n\n" + createPageIndicator(pages.length, page)
+        );
+        em.setFooter({ text: nextFooter ?? "" });
         await interaction.editReply({
             embeds: [em],
             components: components.concat(pages[page].components)
         });
         let i;
         try {
-            i = await m.awaitMessageComponent({time: 300000});
-        } catch(e) { break; }
+            i = await m.awaitMessageComponent({ time: 300000 });
+        } catch (e) {
+            break;
+        }
         nextFooter = null;
         i.deferUpdate();
         if (i.component.customId === "left") {
@@ -133,11 +211,13 @@
                 .setTitle("Clear All Data")
                 .setDescription(
                     "Are you sure you want to delete all data on this server? This includes your settings and all punishment histories.\n\n" +
-                    "**This cannot be undone.**"
+                        "**This cannot be undone.**"
                 )
                 .setColor("Danger")
                 .send(true);
-            if (confirmation.cancelled) { break; }
+            if (confirmation.cancelled) {
+                break;
+            }
             if (confirmation.success) {
                 client.database.guilds.delete(interaction.guild.id);
                 client.database.history.delete(interaction.guild.id);
@@ -149,25 +229,34 @@
             }
         } else {
             const em = new Discord.MessageEmbed(pages[page].embed);
-            em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
-            em.setFooter({text: "Message closed"});
-            interaction.editReply({embeds: [em], components: []});
+            em.setDescription(
+                em.description +
+                    "\n\n" +
+                    createPageIndicator(pages.length, page)
+            );
+            em.setFooter({ text: "Message closed" });
+            interaction.editReply({ embeds: [em], components: [] });
             return;
         }
     }
     const em = new Discord.MessageEmbed(pages[page].embed);
-    em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
-    em.setFooter({text: "Message timed out"});
+    em.setDescription(
+        em.description + "\n\n" + createPageIndicator(pages.length, page)
+    );
+    em.setFooter({ text: "Message timed out" });
     await interaction.editReply({
         embeds: [em],
         components: []
     });
 };
 
-const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
+const check = (
+    _interaction: CommandInteraction,
+    _defaultCheck: WrappedCheck
+) => {
     return true;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
