Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var announceMatchComplete = function (match) {
var vs = match.homeTeam + ' vs ' + match.awayTeam;
var stadium = match.data.c_Stadidum + ', ' + match.data.c_City;
var text = stopExpression + ' ' + slackLink(vs, match.url) + ' (' + stadium + ')';
announce(text);
delete(activeMatches[match.data.n_MatchID]);
};
/**
* Sends a score summary message to slack.
*/
var announceScore = function (match) {
announce(match.homeTeam + ' (' + match.score + ') ' + match.awayTeam);
};
var cronJob = cron.job("*/5 * * * * *", function(){
// Get Match list
requestify.get('http://live.mobileapp.fifa.com/api/wc/matches').then(function(response) {
var matches = response.getBody().data.second;
async.filter(matches, function(item, callback) {
callback (item.b_Live == true || activeMatches[item.n_MatchID]);
}, function(results){
for (var i = 0; i < results.length; i += 1) {
if (activeMatches[results[i].n_MatchID]) {
match = activeMatches[results[i].n_MatchID];
} else {
match = new Match(language);
match.on('startMatch', announceMatchStart);
init: function () {
// each day at 10 AM
const cronJob = cron.job("0 0 10 * * *", () => {
sendNotification();
});
cronJob.start();
},
const cron = require('cron');
const fetch = require('node-fetch');
const { promisify } = require('util');
const fs = require('fs').promises;
const exec = promisify(require('child_process').exec);
const beautify = require('js-beautify').js;
const chunker = require('./chunker');
const searcher = require('./searcher');
const logger = require('./logger');
const jsStyle = require('../style');
const jsonStyle = {
"indent_size": "2",
"eol": "\r\n",
};
const detector = cron.job("0 */30 * * * *", async () => {
try {
const gameConsts = await (await fetch('http://203.104.209.7/gadget_html5/js/kcs_const.js')).text();
const version = gameConsts.match(/\d\.\d\.\d\.\d/)[0];
const currentVersion = await fs.readFile('../version');
if (version !== currentVersion.toString()) {
logger.info(`Detected main.js v${version}`);
const script = await (await fetch(`http://203.104.209.71/kcs2/js/main.js?version=${version}`)).text();
await fs.writeFile(`../raw.js`, script);
await fs.writeFile(`../main.js`, beautify(script, jsStyle));
await fs.writeFile('../version', version);
const functions = /}\((\[function.*)\).default/s.exec(script)[1];
chunker(eval(functions)); // haven't find a better way to parse array of functions
const start = /=\s*(\d*)\)\s*}\(\[/.exec(script)[1];
await fs.writeFile('../tree.json', beautify(JSON.stringify(searcher(start)), jsonStyle));
const { stdout, stderr } = await exec(`"../push.sh" "Update: main.js v${version}"`);
logger.info(stdout);
init : function() {
// every hour
var cronJob = cron.job("0 0 */1 * * *", function() {
checkForNewPhotos(config);
});
cronJob.start();
checkForNewPhotos(config);
},
var cron = require('cron');
//run this cron task every 2 hours
var cronJob = cron.job("0 */2 * * *", function(){
const MongoClient = require('mongodb').MongoClient;
var countries = {}; // a country looks like:
// key -> country code, ex. "US"
// breakdown : [ { score of x : amount of users getting that score }, { } , ...]
// averageScore : 180
// userCount : 15,000
// audioFeatureAverages : audioFeatureAverages
var globalAverageScore = 0;
var globalUserCount = 0;
generateReport();
async function generateReport() {
try{
init: function () {
if (secrets.iftttkey) {
const cronJob = cron.job("0 0 */1 * * *", () => {
checkMovies();
});
cronJob.start();
checkMovies();
}
}
}