worked on premium
diff --git a/TODO b/TODO
index 38073c6..91eecea 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,4 @@
 Role all (?)
 Server rules
-verificationRequired on welcome
\ No newline at end of file
+verificationRequired on welcome
+Role User GUI
\ No newline at end of file
diff --git a/src/commands/nucleus/premium.ts b/src/commands/nucleus/premium.ts
index 1c9db24..9d2c2b1 100644
--- a/src/commands/nucleus/premium.ts
+++ b/src/commands/nucleus/premium.ts
@@ -25,23 +25,23 @@
         ], 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;
+    const dbMember = await client.database.premium.fetchUser(interaction.user.id)
+    let premium = `You do not have premium! You can't activate premium on any servers.`;
     let count = 0;
-    if (member.roles.cache.has("1066468879309750313")) {
+    const {level, appliesTo} = dbMember || {level: 0, appliesTo: []}
+    if (level === 99) {
         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}.`;
+    } else if (level === 1) {
+        premium = `You have Premium tier 1! You can give premium to ${1 - appliesTo.length} more servers.`;
         count = 1;
-    } else if (member.roles.cache.has("1066439526496604194")) {
-        premium = `You have Premium tier 2! You can give premium to ${3 - dbMember}.`;
+    } else if (level === 2) {
+        premium = `You have Premium tier 2! You can give premium to ${3 - appliesTo.length} more servers.`;
         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.`
+    } else if (level === 3) {
+        premium = `You have Premium Mod! You can give premium to ${3 - appliesTo.length} more servers, as well as automatically giving premium to all servers you have a "manage" permission in.`
         count = 3;
     }
-
     const hasPremium = await client.database.premium.hasPremium(interaction.guild!.id);
     let premiumGuild = ""
     if (hasPremium) {
@@ -82,8 +82,7 @@
         if (i) {
             i.deferUpdate();
             let guild = i.guild!;
-            let m = await client.database.premium.fetchTotal(interaction.user.id);
-            if (count - m <= 0) {
+            if (count - appliesTo.length <= 0) {
                 interaction.editReply({
                     embeds: [
                         new EmojiEmbed()
diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts
index c55e463..b929d3d 100644
--- a/src/reflex/scanners.ts
+++ b/src/reflex/scanners.ts
@@ -1,5 +1,4 @@
 import fetch from "node-fetch";
-import FormData from "form-data";
 import fs, { writeFileSync, createReadStream } from "fs";
 import generateFileName from "../utils/temp/generateFileName.js";
 import Tesseract from "node-tesseract-ocr";
@@ -20,8 +19,9 @@
     const [p, hash] = await saveAttachment(link);
     let alreadyHaveCheck = await client.database.scanCache.read(hash)
     if(alreadyHaveCheck) return { nsfw: alreadyHaveCheck.data };
-    const data = new FormData();
-    data.append("file", createReadStream(p));
+    const data = new URLSearchParams();
+    let r = createReadStream(p)
+    data.append("file", r.read(fs.statSync(p).size));
     const result = await fetch("https://unscan.p.rapidapi.com/", {
         method: "POST",
         headers: {
diff --git a/src/utils/database.ts b/src/utils/database.ts
index c7b1777..c85b43a 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -1,6 +1,7 @@
 import type Discord from "discord.js";
 import { Collection, MongoClient } from "mongodb";
 import config from "../config/main.json" assert { type: "json" };
+import client from "../utils/client.js";
 
 const mongoClient = new MongoClient(config.mongoUrl);
 await mongoClient.connect();
@@ -230,18 +231,55 @@
         this.premium = database.collection<PremiumSchema>("premium");
     }
 
+    async updateUser(user: string, level: number) {
+        if(!(await this.userExists(user))) await this.createUser(user, level);
+        await this.premium.updateOne({ user: user }, { $set: { level: level } }, { upsert: true });
+    }
+
+    async userExists(user: string): Promise<boolean> {
+        const entry = await this.premium.findOne({ user: user });
+        return entry ? true : false;
+    }
+
+    async createUser(user: string, level: number) {
+        await this.premium.insertOne({ user: user, appliesTo: [], level: level });
+    }
+
     async hasPremium(guild: string) {
         const entry = await this.premium.findOne({
             appliesTo: { $in: [guild] }
         });
-        if (!entry) return false;
-        return entry.expires.valueOf() > Date.now();
+        return entry ? true : false;
     }
 
-    async fetchTotal(user: string): Promise<number> {
+    async fetchUser(user: string): Promise<PremiumSchema | null> {
         const entry = await this.premium.findOne({ user: user });
-        if (!entry) return 0;
-        return entry.appliesTo.length;
+        if (!entry) return null;
+        return entry;
+    }
+
+    async checkAllPremium() {
+        const entries = await this.premium.find({}).toArray();
+        for(const {user, expiresAt} of entries) {
+            if(expiresAt) expiresAt < new Date().getTime() ? await this.premium.deleteOne({user: user}) : null;
+            const member = await (await client.guilds.fetch("684492926528651336")).members.fetch(user)
+            let level: number = 0;
+            if (member.roles.cache.has("1066468879309750313")) {
+                level = 99;
+            } else if (member.roles.cache.has("1066465491713003520")) {
+                level = 1;
+            } else if (member.roles.cache.has("1066439526496604194")) {
+                level = 2;
+            } else if (member.roles.cache.has("1066464134322978912")) {
+                level = 3;
+            }
+
+            if (level > 0) {
+                await this.updateUser(user, level);
+            } else {
+                await this.premium.updateOne({ user: user }, { expiresAt: (new Date().getTime() + (1000*60*60*24*3)) })
+            }
+        }
     }
 
     addPremium(user: string, guild: string) {
@@ -409,6 +447,6 @@
 export interface PremiumSchema {
     user: string;
     level: number;
-    expires: Date;
     appliesTo: string[];
+    expiresAt?: number;
 }