I hereby decree that this document shall no longer contain the substring " == ", and hereafter shall be referred to as " === ". This amendment shall take effect immediately.

Signed-off-by: pineafan <pineapplefanyt@gmail.com>
diff --git a/src/utils/database.ts b/src/utils/database.ts
index d24c7bf..2f04198 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -40,14 +40,16 @@
         return new Proxy(structuredClone(this.defaultData), Entry(entry)) as unknown as GuildConfig
     }
 
-    async write(guild: string, set: object = {}, unset: string[] = []) {
+    async write(guild: string, set: object | null, unset: string[] | string = []) {
         let uo = {}
+        if (!Array.isArray(unset)) unset = [unset]
         for (let key of unset) {
             uo[key] = null;
         }
-        let out = {}
+        let out = {$set: {}, $unset: {}}
         if (set) out["$set"] = set;
         if (unset.length) out["$unset"] = uo;
+        console.log(out)
         await this.guilds.updateOne({ id: guild }, out, { upsert: true });
     }
 
@@ -79,6 +81,10 @@
             }, { upsert: true });
         }
     }
+
+    async delete(guild: string) {
+        await this.guilds.deleteOne({ id: guild });
+    }
 }
 
 
@@ -116,6 +122,10 @@
         }).toArray()) as HistorySchema[];
         return entry;
     }
+
+    async delete(guild: string) {
+        await this.histories.deleteMany({ guild: guild });
+    }
 }
 
 export class ModNotes {
@@ -147,7 +157,7 @@
 
     async hasPremium(guild: string) {
         let entry = await this.premium.findOne({ appliesTo: { $in: [guild] } });
-        return entry != null;
+        return entry !== null;
     }
 }