Added EU fire stats tweets

This commit is contained in:
vjrj 2018-03-22 17:42:13 +01:00
parent 452f6baf45
commit 1eb6e45dfe
5 changed files with 80 additions and 21 deletions

View file

@ -2,7 +2,7 @@
/* eslint-disable import/no-absolute-path */
import { Meteor } from 'meteor/meteor';
import { tweetFires } from '/imports/api/ActiveFires/server/tweetFiresInZone';
import { tweetIberiaFires, tweetEuropeFires } from '/imports/api/ActiveFires/server/tweetFiresInZone';
// https://github.com/thesaucecode/meteor-synced-cron/
@ -55,7 +55,7 @@ Meteor.startup(() => {
}
return sched;
},
job: () => tweetFires()
job: () => tweetIberiaFires()
/* console.log('cron is working');
* console.log(this.userID) // Context Object becomes this argument
* console.log(this.magic) /
@ -64,5 +64,18 @@ Meteor.startup(() => {
return tweetFires(); */
});
SyncedCron.add({
name: 'Check for fires stats in Europe and tweet about',
timezone: 'Europe/Madrid',
schedule: (parser) => {
const sched = parser.text(Meteor.settings.private.twitter.en.when);
if (sched.error !== -1) {
console.error(`Twitter cron 'when' field parsed with errors: ${sched.error}`);
}
return sched;
},
job: () => tweetEuropeFires()
});
SyncedCron.start();
});