forked from GitHub/dbot
		
	Timed save
This commit is contained in:
		
							parent
							
								
									1d6e83b3c0
								
							
						
					
					
						commit
						065611bcff
					
				| @ -15,8 +15,6 @@ var kick = function(dbot) { | ||||
|                 } | ||||
|                 dbot.say(data.channel, data.kickee + '-- (' + data.kickee + ' has been kicked ' + dbot.db.kicks[data.kickee] + ' times)'); | ||||
|             } | ||||
| 
 | ||||
|             dbot.save(); | ||||
|         }, | ||||
| 
 | ||||
|         on: 'KICK' | ||||
|  | ||||
| @ -120,7 +120,6 @@ var quotes = function(dbot) { | ||||
|                 addStack.push('realityonce'); | ||||
|                 rmAllowed = true; | ||||
|                 dbot.instance.say(data.channel, '\'reality ' + once[1] + '.\' saved.'); | ||||
|                 dbot.save(); | ||||
|             } | ||||
|         }, | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										8
									
								
								run.js
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								run.js
									
									
									
									
									
								
							| @ -28,7 +28,7 @@ DBot.prototype.say = function(channel, data) { | ||||
| }; | ||||
| 
 | ||||
| DBot.prototype.save = function() { | ||||
|     fs.writeFile('db.json', JSON.stringify(this.db, null, '    ')); | ||||
|     fs.writeFileSync('db.json', JSON.stringify(this.db, null, '    ')); | ||||
| }; | ||||
| 
 | ||||
| DBot.prototype.reloadModules = function() { | ||||
| @ -45,6 +45,11 @@ DBot.prototype.reloadModules = function() { | ||||
|     this.commands = {}; | ||||
|     this.timers.clearTimers(); | ||||
| 
 | ||||
|     this.save(); | ||||
|     this.timers.addTimer(1000 * 60 * 10, function() { | ||||
|         this.save(); | ||||
|     }); | ||||
| 
 | ||||
|     var path = require.resolve('./snippets'); | ||||
|     require.cache[path] = undefined; | ||||
|     require('./snippets'); | ||||
| @ -90,7 +95,6 @@ DBot.prototype.reloadModules = function() { | ||||
|             else { | ||||
|                 this.commands[params[0]](data, params); | ||||
|             } | ||||
|             this.save(); | ||||
|         } else { | ||||
|             var q = data.message.valMatch(/^~([\d\w\s]*)/, 2); | ||||
|             if(q) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Luke Slater
						Luke Slater