From de4d35d2132e3bf44b51da3876f91149b74ec6f1 Mon Sep 17 00:00:00 2001 From: lanxu Date: Tue, 19 Apr 2022 18:44:54 +0300 Subject: [PATCH] Fixed timezone offset for cron --- app.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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'); }