Redis appeared

This commit is contained in:
Stanislaw
2022-03-11 12:45:33 +01:00
parent 8a3f9bb03c
commit 5d5efa884d
5 changed files with 448 additions and 41 deletions

19
src/functions/redis.js Normal file
View File

@@ -0,0 +1,19 @@
module.exports = {
expCheck: async function (userID, connect) {
date = new Date();
const user = await connect.get(userID);
if (user == null) {
await connect.set(userID, date.getTime());
return true;
} else {
date = await connect.get(userID);
const currentDate = new Date();
if (currentDate.getTime() - date > 60000) {
await connect.set(userID, currentDate.getTime());
return true;
} else {
return false;
}
}
},
};