diff --git a/app.js b/app.js index 6b1e563..2f1d867 100644 --- a/app.js +++ b/app.js @@ -4,7 +4,7 @@ const path = require('path') // Load config const config = require('./config') -const cron = require('node-cron') +const CronJob = require('cron').CronJob // Load new plugins const PluginManager = require('./plugins/pluginManager.js') @@ -118,13 +118,13 @@ client.addListener('names', function (channel, nicks) { for (let i = 0; i < config.cron.length; i++) { let row = config.cron[i] - cron.schedule(row.cron, () => { + logger.info('starting cron with ' + row.cron) + const job = new CronJob(row.cron, () => { + logger.info('cron triggered. Running command ' + row.command) if (client.conn !== null) { for (let c = 0; c < config.irc.channels.length; c++) { handleMessage('BOT', config.irc.channels[c], row.command) } } - }, { - timezone: "Europe/Helsinki" - }) + }, null, true, 'Europe/Helsinki'); }