Development (#13)

Co-authored-by: PineaFan <ash@pinea.dev>
Co-authored-by: pineafan <pineapplefanyt@gmail.com>
Co-authored-by: PineappleFan <PineaFan@users.noreply.github.com>
Co-authored-by: Skyler <skyler3665@gmail.com>
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index 004f5ff..a1b094e 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -330,7 +330,6 @@
             ],
             components: [
                 new Discord.ActionRowBuilder<ButtonBuilder>().addComponents([
-
                     new ButtonBuilder().setLabel("View").setStyle(ButtonStyle.Link).setURL(`https://clicks.codes/nucleus/transcript/${code}?key=${key}&iv=${iv}`).setDisabled(!code),
 
                 ])
diff --git a/src/commands/privacy.ts b/src/commands/privacy.ts
index dcdebb1..69c8980 100644
--- a/src/commands/privacy.ts
+++ b/src/commands/privacy.ts
@@ -183,7 +183,6 @@
                 await client.database.history.delete(interaction.guild!.id);
                 await client.database.notes.delete(interaction.guild!.id);
                 await client.database.transcripts.deleteAll(interaction.guild!.id);
-
                 nextFooter = "All data cleared";
                 continue;
             } else {
diff --git a/src/config/main.d.ts b/src/config/main.d.ts
index 6549234..75eb9e0 100644
--- a/src/config/main.d.ts
+++ b/src/config/main.d.ts
@@ -15,11 +15,9 @@
         password: string,
         database: string,
         host: string,
+        authSource: string
     },
     baseUrl: string,
-    pastebinApiKey: string,
-    pastebinUsername: string,
-    pastebinPassword: string,
     rapidApiKey: string
 };
 
diff --git a/src/context/messages/purgeto.ts b/src/context/messages/purgeto.ts
index 616b085..3d7e95a 100644
--- a/src/context/messages/purgeto.ts
+++ b/src/context/messages/purgeto.ts
@@ -206,9 +206,7 @@
         ],
         components: [
             new Discord.ActionRowBuilder<ButtonBuilder>().addComponents([
-
                 new ButtonBuilder().setLabel("View").setStyle(ButtonStyle.Link).setURL(`https://clicks.codes/nucleus/transcript/${code}?key=${key}&iv=${iv}`).setDisabled(!code),
-
             ])
         ]
     });
diff --git a/src/premium/createTranscript.ts b/src/premium/createTranscript.ts
index dd01a98..fa5ec84 100644
--- a/src/premium/createTranscript.ts
+++ b/src/premium/createTranscript.ts
@@ -60,9 +60,7 @@
 
     const newOut = await client.database.transcripts.createTranscript(messages, interaction, member);
 
-
     const [code, key, iv] = await client.database.transcripts.create(newOut);
-
     if(!code) return await interaction.reply({
         embeds: [
             new EmojiEmbed()
@@ -88,9 +86,7 @@
         ],
         components: [
             new ActionRowBuilder<ButtonBuilder>().addComponents([
-
                 new ButtonBuilder().setLabel("View").setStyle(ButtonStyle.Link).setURL(`https://testing.coded.codes/nucleus/transcript/${code}?key=${key}&iv=${iv}`),
-
                 new ButtonBuilder()
                     .setLabel("Delete")
                     .setStyle(ButtonStyle.Danger)
diff --git a/src/utils/database.ts b/src/utils/database.ts
index 06c41f0..67c1c5f 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -6,22 +6,14 @@
 import * as crypto from "crypto";
 import _ from "lodash";
 import defaultData from '../config/default.js';
-// config.mongoOptions.host, {
-//     auth: {
-//         username: config.mongoOptions.username,
-//         password: config.mongoOptions.password
-//     },
-//     authSource: config.mongoOptions.authSource
-// }
-// mongodb://emails:SweetLife2023!!@127.0.0.1:28180/saveEmail?retryWrites=true&w=majority
+
 const username = encodeURIComponent(config.mongoOptions.username);
 const password = encodeURIComponent(config.mongoOptions.password);
-const mongoClient = new MongoClient(username ? `mongodb://${username}:${password}@${config.mongoOptions.host}` : `mongodb://${config.mongoOptions.host}`, {authSource: "admin"});
+const mongoClient = new MongoClient(username ? `mongodb://${username}:${password}@${config.mongoOptions.host}?authMechanism=DEFAULT` : `mongodb://${config.mongoOptions.host}`, {authSource: "admin"});
 await mongoClient.connect();
 const database = mongoClient.db();
 
 const collectionOptions = { authdb: "admin" };
-
 const getIV = () => crypto.randomBytes(16);
 
 
@@ -542,7 +534,6 @@
         const entry = await this.premium.findOne({ user: user });
         return entry ? true : false;
     }
-
     async createUser(user: string, level: number) {
         // console.log("Premium createUser");
         await this.premium.insertOne({ user: user, appliesTo: [], level: level }, collectionOptions);
diff --git a/src/utils/log.ts b/src/utils/log.ts
index c6416a1..bb95eda 100644
--- a/src/utils/log.ts
+++ b/src/utils/log.ts
@@ -79,7 +79,10 @@
     },
     async log(log: LoggerOptions): Promise<void> {
         if (!await isLogging(log.hidden.guild, log.meta.calculateType)) return;
+        console.log(log.hidden.guild)
         const config = await client.database.guilds.read(log.hidden.guild);
+        console.log(config.logging.logs.channel)
+
         if (config.logging.logs.channel) {
             const channel = (await client.channels.fetch(config.logging.logs.channel)) as Discord.TextChannel | null;
             const description: Record<string, string> = {};