Fixed timezone offset for cron

master
lanxu 2022-04-19 18:44:54 +03:00
parent 47b8e0e9c0
commit de4d35d213
1 changed files with 5 additions and 5 deletions

10
app.js
View File

@ -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');
}