diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index 05c5494..5bfbfdb 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -1,4 +1,4 @@
-import { TextInputBuilder } from "discord.js";
+import { ButtonInteraction, TextInputBuilder } from "discord.js";
 import Discord, {
     CommandInteraction,
     Message,
@@ -24,7 +24,7 @@
 }
 
 class confirmationMessage {
-    interaction: CommandInteraction;
+    interaction: CommandInteraction | ButtonInteraction;
     title = "";
     emoji = "";
     redEmoji: string | null = null;
@@ -37,7 +37,9 @@
     inverted = false;
     reason: string | null = null;
 
-    constructor(interaction: CommandInteraction) {
+    modals: {buttonText: string, emoji: string, customId: string, modal: Discord.ModalBuilder, value: string | undefined}[] = [];
+
+    constructor(interaction: CommandInteraction | ButtonInteraction) {
         this.interaction = interaction;
     }
 
@@ -98,11 +100,17 @@
         this.reason = reason;
         return this;
     }
+    addModal(buttonText: string, emoji: string, customId: string, current: string, modal: Discord.ModalBuilder) {
+        modal.setCustomId(customId);
+        this.modals.push({buttonText, emoji, customId, modal, value: current});
+        return this;
+    }
     async send(editOnly?: boolean): Promise<{
         success?: boolean;
         cancelled?: boolean;
         components?: Record<string, CustomBoolean<unknown>>;
         newReason?: string;
+        modals?: {buttonText: string, emoji: string, customId: string, modal: Discord.ModalBuilder, value: string | undefined}[];
     }> {
         let cancelled = false;
         let success: boolean | undefined = undefined;
@@ -131,6 +139,16 @@
                 if (v.emoji !== undefined) button.setEmoji(getEmojiByName(v.emoji, "id"));
                 fullComponents.push(button);
             });
+            for (const modal of this.modals) {
+                fullComponents.push(
+                    new Discord.ButtonBuilder()
+                        .setCustomId(modal.customId)
+                        .setLabel(modal.buttonText)
+                        .setStyle(ButtonStyle.Primary)
+                        .setEmoji(getEmojiByName(modal.emoji, "id"))
+                        .setDisabled(false)
+                );
+            }
             if (this.reason !== null)
                 fullComponents.push(
                     new Discord.ButtonBuilder()
@@ -183,7 +201,6 @@
                     m = (await this.interaction.reply(object)) as unknown as Message;
                 }
             } catch (e) {
-                console.log(e);
                 cancelled = true;
                 continue;
             }
@@ -195,7 +212,7 @@
                     time: 300000
                 });
             } catch (e) {
-                success = false;
+                success = false
                 break;
             }
             if (component.customId === "yes") {
@@ -273,6 +290,46 @@
                     returnComponents = true;
                     continue;
                 }
+            } else if (this.modals.map((m) => m.customId).includes(component.customId)) {
+                const chosenModal = this.modals.find((component => m => m.customId === component.customId)(component));
+                await component.showModal(chosenModal!.modal);
+                await this.interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle(this.title)
+                            .setDescription("Modal opened. If you can't see it, click back and try again.")
+                            .setStatus(this.color)
+                            .setEmoji(this.emoji)
+                    ],
+                    components: [
+                        new ActionRowBuilder<Discord.ButtonBuilder>().addComponents(
+                            new ButtonBuilder()
+                                .setLabel("Back")
+                                .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                                .setStyle(ButtonStyle.Primary)
+                                .setCustomId("back")
+                        )
+                    ]
+                });
+                let out;
+                try {
+                    out = (await modalInteractionCollector(
+                        m,
+                        this.interaction.user
+                    )) as Discord.ModalSubmitInteraction | null;
+                } catch (e) {
+                    console.log(e);
+                    cancelled = true;
+                    continue;
+                }
+                if (out === null || out.isButton()) {
+                    continue;
+                }
+                if (out instanceof ModalSubmitInteraction) {
+                    chosenModal!.value = out.fields.getTextInputValue("default");
+                }
+                returnComponents = true;
+                continue;
             } else {
                 component.deferUpdate();
                 this.customButtons[component.customId]!.active = !this.customButtons[component.customId]!.active;
@@ -297,17 +354,19 @@
                 ],
                 components: []
             });
-            return { success: false };
+            return { success: false, cancelled: returnValue.cancelled ?? false };
         }
         if (returnComponents || success !== undefined) returnValue.components = this.customButtons;
         if (success !== undefined) returnValue.success = success;
         if (newReason) returnValue.newReason = newReason;
+        returnValue.modals = this.modals;
 
+        const modals = this.modals;
         const typedReturnValue = returnValue as
             | { cancelled: true }
-            | { success: boolean; components: Record<string, CustomBoolean<unknown>>; newReason?: string }
-            | { newReason: string; components: Record<string, CustomBoolean<unknown>> }
-            | { components: Record<string, CustomBoolean<unknown>> };
+            | { success: boolean; components: Record<string, CustomBoolean<unknown>>; modals: typeof modals; newReason?: string }
+            | { newReason: string; components: Record<string, CustomBoolean<unknown>>; modals: typeof modals }
+            | { components: Record<string, CustomBoolean<unknown>>; modals: typeof modals };
 
         return typedReturnValue;
     }
diff --git a/src/utils/database.ts b/src/utils/database.ts
index 75a79d9..62aee7c 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -14,14 +14,17 @@
 import _ from "lodash";
 import defaultData from "../config/default.js";
 
-const username = encodeURIComponent(config.mongoOptions.username);
-const password = encodeURIComponent(config.mongoOptions.password);
+let username, password;
+
+// @ts-expect-error
+if (Object.keys(config.mongoOptions).includes("username")) username = encodeURIComponent(config.mongoOptions.username);
+// @ts-expect-error
+if (Object.keys(config.mongoOptions).includes("password")) password = encodeURIComponent(config.mongoOptions.password);
 
 const mongoClient = new MongoClient(
     username
-        ? `mongodb://${username}:${password}@${config.mongoOptions.host}?authMechanism=DEFAULT`
-        : `mongodb://${config.mongoOptions.host}`,
-    { authSource: config.mongoOptions.authSource }
+        ? `mongodb://${username}:${password}@${config.mongoOptions.host}?authMechanism=DEFAULT&authSource=${config.mongoOptions.authSource}`
+        : `mongodb://${config.mongoOptions.host}`
 );
 await mongoClient.connect();
 const database = mongoClient.db();
@@ -221,7 +224,7 @@
 interface findDocSchema {
     channelID: string;
     messageID: string;
-    code: string;
+    transcript: string;
 }
 
 export class Transcript {
@@ -284,20 +287,16 @@
     async deleteAll(guild: string) {
         // console.log("Transcript delete")
         const filteredDocs = await this.transcripts.find({ guild: guild }).toArray();
-        const filteredDocs1  = await this.messageToTranscript.find({ guild: guild }).toArray();
         for (const doc of filteredDocs) {
             await this.transcripts.deleteOne({ code: doc.code });
         }
-        for (const doc of filteredDocs1) {
-            await this.messageToTranscript.deleteOne({ code: doc.code });
-        }
     }
 
     async readEncrypted(code: string) {
         // console.log("Transcript read")
         let doc: TranscriptSchema | null = await this.transcripts.findOne({ code: code });
         let findDoc: findDocSchema | null = null;
-        if (!doc) findDoc = await this.messageToTranscript.findOne({ code: code });
+        if (!doc) findDoc = await this.messageToTranscript.findOne({ transcript: code });
         if (findDoc) {
             const message = await (
                 client.channels.cache.get(findDoc.channelID) as Discord.TextBasedChannel | null
@@ -334,7 +333,7 @@
         let doc: TranscriptSchema | null = await this.transcripts.findOne({ code: code });
         let findDoc: findDocSchema | null = null;
         console.log(doc);
-        if (!doc) findDoc = await this.messageToTranscript.findOne({ code: code });
+        if (!doc) findDoc = await this.messageToTranscript.findOne({ transcript: code });
         if (findDoc) {
             const message = await (
                 client.channels.cache.get(findDoc.channelID) as Discord.TextBasedChannel | null
@@ -837,6 +836,10 @@
     }
 }
 
+export class Plugins {
+    
+}
+
 export interface GuildConfig {
     id: string;
     version: number;
