Cron job for checking mediawiki changes
This commit is contained in:
parent
c97cc82817
commit
581b15da69
@ -1,6 +1,7 @@
|
|||||||
const util = require('util');
|
const util = require('util');
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
const groupArray = require('group-array');
|
const groupArray = require('group-array');
|
||||||
|
const cron = require('node-cron');
|
||||||
|
|
||||||
module.exports = async function(robot, kredits) {
|
module.exports = async function(robot, kredits) {
|
||||||
|
|
||||||
@ -165,9 +166,13 @@ module.exports = async function(robot, kredits) {
|
|||||||
robot.brain.set('kredits:mediawiki:last_processed_at', new Date().toISOString());
|
robot.brain.set('kredits:mediawiki:last_processed_at', new Date().toISOString());
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchChanges()
|
function processWikiChangesSinceLastRun () {
|
||||||
.then(res => groupChangesByUser(res))
|
fetchChanges()
|
||||||
.then(res => createProposals(res))
|
.then(res => groupChangesByUser(res))
|
||||||
.then(() => updateTimestampForNextFetch());
|
.then(res => createProposals(res))
|
||||||
|
.then(() => updateTimestampForNextFetch());
|
||||||
|
}
|
||||||
|
|
||||||
|
cron.schedule('* 7 * * *', processWikiChangesSinceLastRun);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user