mirror of
https://github.com/reality/dbot.git
synced 2025-01-23 10:34:31 +01:00
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.say(data.channel, data.kickee + '-- (' + data.kickee + ' has been kicked ' + dbot.db.kicks[data.kickee] + ' times)');
|
||||||
}
|
}
|
||||||
|
|
||||||
dbot.save();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
on: 'KICK'
|
on: 'KICK'
|
||||||
|
@ -120,7 +120,6 @@ var quotes = function(dbot) {
|
|||||||
addStack.push('realityonce');
|
addStack.push('realityonce');
|
||||||
rmAllowed = true;
|
rmAllowed = true;
|
||||||
dbot.instance.say(data.channel, '\'reality ' + once[1] + '.\' saved.');
|
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() {
|
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() {
|
DBot.prototype.reloadModules = function() {
|
||||||
@ -45,6 +45,11 @@ DBot.prototype.reloadModules = function() {
|
|||||||
this.commands = {};
|
this.commands = {};
|
||||||
this.timers.clearTimers();
|
this.timers.clearTimers();
|
||||||
|
|
||||||
|
this.save();
|
||||||
|
this.timers.addTimer(1000 * 60 * 10, function() {
|
||||||
|
this.save();
|
||||||
|
});
|
||||||
|
|
||||||
var path = require.resolve('./snippets');
|
var path = require.resolve('./snippets');
|
||||||
require.cache[path] = undefined;
|
require.cache[path] = undefined;
|
||||||
require('./snippets');
|
require('./snippets');
|
||||||
@ -90,7 +95,6 @@ DBot.prototype.reloadModules = function() {
|
|||||||
else {
|
else {
|
||||||
this.commands[params[0]](data, params);
|
this.commands[params[0]](data, params);
|
||||||
}
|
}
|
||||||
this.save();
|
|
||||||
} else {
|
} else {
|
||||||
var q = data.message.valMatch(/^~([\d\w\s]*)/, 2);
|
var q = data.message.valMatch(/^~([\d\w\s]*)/, 2);
|
||||||
if(q) {
|
if(q) {
|
||||||
|
Loading…
Reference in New Issue
Block a user