From e1c028789af7f99bd7279eae0bf50f4cfdb7650c Mon Sep 17 00:00:00 2001 From: ION606 Date: Sun, 31 Jul 2022 10:06:36 +0300 Subject: [PATCH] Fixed an async issue --- main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index ff73fae..8557563 100644 --- a/main.js +++ b/main.js @@ -142,13 +142,13 @@ app.post('/sendData', async (req, res) => { try { const pref = JSON.parse(req.headers.serversettings); - connection.then((client) => { + connection.then(async (client) => { const dbo = client.db(pref.Id).collection('SETUP'); await dbo.updateOne({ _id: 'WELCOME' }, {$set: { welcomechannel: pref.WELCOME.welcomechannel, welcomemessage: pref.WELCOME.welcomemessage }}); await dbo.updateOne({ _id: 'LOG' }, {$set: { keepLogs: pref.LOG.keepLogs, logchannel: pref.LOG.logchannel, severity: pref.LOG.severity }}); }).then(() => { res.send("DONE"); }) - + } catch (err) { console.error(err); res.send("FAILED");