added version 2.0

This commit is contained in:
Lukian LEIZOUR 2024-03-04 20:38:46 +01:00
parent 0163d40b4e
commit 0f18925d1a
3231 changed files with 1449 additions and 374732 deletions

23
libs/quotaReset.js Normal file
View file

@ -0,0 +1,23 @@
const fs = require("fs");
const { resetQuotas } = require("./mysql.js");
function getLastResetDate() {
const data = fs.readFileSync("./data/lastReset", "utf8");
return parseInt(data);
}
function checkLastResetDate() {
const lastResetDate = getLastResetDate();
const now = Date.now();
if (now - lastResetDate > 1000 * 60 * 60 * 24 * 30) {
fs.writeFileSync("./data/lastReset", now.toString());
return resetQuotas();
} else {
return false;
}
}
module.exports = {
checkLastResetDate,
};