Removed the excessive connecting and closing of the MongoDb databases

This commit is contained in:
ION606
2022-07-31 10:11:55 +03:00
parent 6d8aa991b6
commit 14dd4e002a
10 changed files with 197 additions and 221 deletions
+1 -2
View File
@@ -14,8 +14,7 @@ for (i in categoriesJSON) {
function changeDB(bot, message, m) {
try {
const client = new MongoClient(bot.mongouri, { useNewUrlParser: true, useUnifiedTopology: true, serverApi: ServerApiVersion.v1 });
client.connect(err => {
bot.mongoconnection.then(client => {
const dbo = client.db(message.guild.id).collection('trivia');
//Game Over
if (m == null) {