You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
486 B
11 lines
486 B
const StatusCache = require('../models/statuses');
|
|
|
|
module.exports = async (id, time) => {
|
|
let statuses = await StatusCache.findOne({f: 'lol'}) || new StatusCache({f: 'lol', statuses: []});
|
|
let exists = false;
|
|
let status; for (status of statuses.statuses) {
|
|
if (status.id === id) {statuses.statuses[statuses.statuses.indexOf(status)].clear = time; exists = true;}
|
|
}
|
|
if (!exists) {statuses.statuses.push({id: id, clear: time});}
|
|
return statuses.save();
|
|
}; |