Use an sqlite3 database for timer feature

There were some other small edits as well, mostly formatting or better
logging in certain functions
This commit is contained in:
SileNce5k 2023-05-27 22:16:43 +02:00
parent a098ab6616
commit d41b28ec91
No known key found for this signature in database
GPG key ID: 961132EB78C8915F
13 changed files with 2277 additions and 59 deletions

View file

@ -0,0 +1,26 @@
const sqlite3 = require('sqlite3').verbose();
module.exports = async function () {
const db = new sqlite3.Database('data/database.db');
return new Promise ((resolve, reject)=>{
db.run(
`CREATE TABLE IF NOT EXISTS timers (
ID INTEGER PRIMARY KEY AUTOINCREMENT,
user TEXT,
reminderTime INTEGER,
channel TEXT,
customMessage TEXT,
hasPassed INTEGER)`,
(err) => {
if (err) {
console.error(`Error while creating table 'timers': ${err}`);
reject(err);
} else {
console.log("Table 'timers' created successfully.");
resolve();
}
db.close();
}
);
})
}

6
server/input.js Normal file
View file

@ -0,0 +1,6 @@
const prompt = require("prompt-sync")();
module.exports = function(client, owners, message){
let input;
}

View file

@ -3,7 +3,6 @@ const checkTimer = require('../util/timer/checkTimer');
const updatePresence = require('../util/updatePresence');
module.exports = function(client, enableLoginMessage, loginChannel, loginMessage) {
console.clear();
updatePresence(client)
console.log('Ready!');
if (enableLoginMessage === true)