Keep database connection open (for now)

trimming phone number from cheogram jid
This commit is contained in:
Stephen Vanderwarker 2023-11-07 08:57:47 -05:00
parent 0b3895edcc
commit 872e79e3a1

View File

@ -39,15 +39,15 @@ if (fs.existsSync('./config.ini')) {
const now = new Date(); const now = new Date();
const validUntil = now.getTime() + (30 * 24 * 60 * 60 * 1000); const validUntil = now.getTime() + (30 * 24 * 60 * 60 * 1000);
const insertStmt = db.prepare('INSERT INTO users (pnum, token) VALUES (?, ?)'); const insertStmt = db.prepare('INSERT INTO users (pnum, token) VALUES (?, ?)');
insertStmt.run(from, validUntil); insertStmt.run(from.split("@")[0], validUntil);
insertStmt.finalize(); insertStmt.finalize();
console.log('Data inserted successfully'); console.log('Data inserted successfully');
db.close((err) => { // db.close((err) => {
if (err) { // if (err) {
return console.error('Error closing the database:', err.message); // return console.error('Error closing the database:', err.message);
} // }
console.log('Database connection closed.'); // console.log('Database connection closed.');
}); // });
debug(); debug();
} }
else { else {