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/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> = {};