3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-23 20:39:25 +01:00

reload default strings in updateModules

This commit is contained in:
Luke Slater 2012-12-11 20:47:50 +00:00
parent b641dcd34a
commit 19c3497f11
2 changed files with 6 additions and 2 deletions

View File

@ -53,7 +53,6 @@ var admin = function(dbot) {
// Reload DB, translations and modules.
'reload': function(event) {
dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));
dbot.strings = JSON.parse(fs.readFileSync('strings.json', 'utf-8'));
dbot.reloadModules();
event.reply(dbot.t('reload'));
},

7
run.js
View File

@ -151,11 +151,16 @@ DBot.prototype.reloadModules = function() {
this.modules = [];
this.commands = {};
this.commandMap = {}; // Map of which commands belong to which modules
this.strings = {};
this.usage = {};
this.timers.clearTimers();
this.save();
try {
this.strings = JSON.parse(fs.readFileSync('strings.json', 'utf-8'));
} catch(err) {
this.strings = {};
}
// Enforce having command. it can still be reloaded, but dbot _will not_
// function without it, so not having it should be impossible
if(!this.moduleNames.include("command")) {