diff --git a/src/commands/nucleus/premium.ts b/src/commands/nucleus/premium.ts
index 745f167..2b969b9 100644
--- a/src/commands/nucleus/premium.ts
+++ b/src/commands/nucleus/premium.ts
@@ -1,26 +1,75 @@
-import type { CommandInteraction } from "discord.js";
+import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction } from "discord.js";
 import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import client from "../../utils/client.js";
+import { LoadingEmbed } from "../../utils/defaults.js";
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
     builder.setName("premium").setDescription("Information about Nucleus Premium");
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
-    interaction.reply({
-        embeds: [
+    await interaction.reply({embeds: LoadingEmbed, ephemeral: true})
+    const member = await (await interaction.client.guilds.fetch("684492926528651336")).members.fetch(interaction.user.id)
+    const firstDescription = "\n\nPremium allows your server to get access to extra features, for a fixed price per month.\nThis includes:\n" +
+        "- Attachment logs - Stores attachments so they can be viewed after a message is deleted.\n" +
+        "- Ticket Transcripts - Gives a link to view the history of a ticket after it has been closed.\n"
+    if(!member) {
+        interaction.editReply({ embeds: [
             new EmojiEmbed()
                 .setTitle("Premium")
                 .setDescription(
-                    "*Nucleus Premium is currently not available.*\n\n" +
-                        "Premium allows your server to get access to extra features, for a fixed price per month.\nThis includes:\n" +
-                        "- Attachment logs - Stores attachments so they can be viewed after a message is deleted.\n" +
-                        "- Ticket Transcripts - Gives a link to view the history of a ticket after it has been closed.\n"
+                    `*You are not currently in the Clicks Server. To gain access to premium please join.*` + firstDescription
                 )
                 .setEmoji("NUCLEUS.LOGO")
                 .setStatus("Danger")
-        ],
-        ephemeral: true
-    });
+        ], components: [new ActionRowBuilder<ButtonBuilder>().addComponents(new ButtonBuilder().setStyle(ButtonStyle.Link).setLabel("Join").setURL("https://discord.gg/bPaNnxe"))] });
+        return;
+    }
+    const dbMember = await client.database.premium.fetchTotal(interaction.user.id)
+    let premium;
+    let count = 0;
+    if (member.roles.cache.has("1066468879309750313")) {
+        premium = `You have Infinite Premium! You have been gifted this by the developers as a thank you. You can give premium to any and all servers you are in.`;
+        count = 200;
+    } else if (member.roles.cache.has("1066465491713003520")) {
+        premium = `You have Premium tier 1! You can give premium to ${1 - dbMember}.`;
+        count = 1;
+    } else if (member.roles.cache.has("1066439526496604194")) {
+        premium = `You have Premium tier 2! You can give premium to ${3 - dbMember}.`;
+        count = 3;
+    } else if (member.roles.cache.has("1066464134322978912")) {
+        premium = `You have Premium Mod! You already give premium to all servers you have a "manage" permission in.`
+        count = 3;
+    }
+
+    let closed = false;
+    do {
+        interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Premium")
+                    .setDescription(
+                        premium + firstDescription
+                    )
+                    .setEmoji("NUCLEUS.LOGO")
+                    .setStatus("Danger")
+            ],
+            components: [
+                new ActionRowBuilder<ButtonBuilder>()
+                    .addComponents(
+                        new ButtonBuilder()
+                            .setStyle(ButtonStyle.Primary)
+                            .setLabel("Activate Premium here")
+                            .setCustomId("premiumActivate")
+                            .setDisabled(count <= 0)
+                    )
+            ]
+        });
+
+        const filter = (i: any) => i.customId === "premiumActivate" && i.user.id === interaction.user.id;
+        const collector = interaction.channel?.awaitMessageComponent({ filter, time: 60000 });
+        
+    } while (closed);
 };
 
 const check = () => {
