Fixed timezone offset for cron
This commit is contained in:
		
							parent
							
								
									47b8e0e9c0
								
							
						
					
					
						commit
						de4d35d213
					
				
							
								
								
									
										10
									
								
								app.js
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								app.js
									
									
									
									
									
								
							| @ -4,7 +4,7 @@ const path = require('path') | |||||||
| 
 | 
 | ||||||
| // Load config
 | // Load config
 | ||||||
| const config = require('./config') | const config = require('./config') | ||||||
| const cron = require('node-cron') | const CronJob = require('cron').CronJob | ||||||
| 
 | 
 | ||||||
| // Load new plugins
 | // Load new plugins
 | ||||||
| const PluginManager = require('./plugins/pluginManager.js') | 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++) { | for (let i = 0; i < config.cron.length; i++) { | ||||||
|   let row = config.cron[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) { |     if (client.conn !== null) { | ||||||
|       for (let c = 0; c < config.irc.channels.length; c++) { |       for (let c = 0; c < config.irc.channels.length; c++) { | ||||||
|         handleMessage('BOT', config.irc.channels[c], row.command) |         handleMessage('BOT', config.irc.channels[c], row.command) | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   }, { |   }, null, true, 'Europe/Helsinki'); | ||||||
|     timezone: "Europe/Helsinki" |  | ||||||
|   }) |  | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user