From 872e79e3a1a7c4b441588c480871dd3b84a30ccf Mon Sep 17 00:00:00 2001 From: stephen Date: Tue, 7 Nov 2023 08:57:47 -0500 Subject: [PATCH] Keep database connection open (for now) trimming phone number from cheogram jid --- index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index fa957cd..22f9065 100644 --- a/index.js +++ b/index.js @@ -39,15 +39,15 @@ if (fs.existsSync('./config.ini')) { const now = new Date(); const validUntil = now.getTime() + (30 * 24 * 60 * 60 * 1000); const insertStmt = db.prepare('INSERT INTO users (pnum, token) VALUES (?, ?)'); - insertStmt.run(from, validUntil); + insertStmt.run(from.split("@")[0], validUntil); insertStmt.finalize(); console.log('Data inserted successfully'); - db.close((err) => { - if (err) { - return console.error('Error closing the database:', err.message); - } - console.log('Database connection closed.'); - }); + // db.close((err) => { + // if (err) { + // return console.error('Error closing the database:', err.message); + // } + // console.log('Database connection closed.'); + // }); debug(); } else {