added version 2.0
This commit is contained in:
parent
0163d40b4e
commit
0f18925d1a
3231 changed files with 1449 additions and 374732 deletions
23
libs/quotaReset.js
Normal file
23
libs/quotaReset.js
Normal 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,
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue