forked from GitHub/dbot
reload default strings in updateModules
This commit is contained in:
parent
b641dcd34a
commit
19c3497f11
@ -53,7 +53,6 @@ var admin = function(dbot) {
|
|||||||
// Reload DB, translations and modules.
|
// Reload DB, translations and modules.
|
||||||
'reload': function(event) {
|
'reload': function(event) {
|
||||||
dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));
|
dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));
|
||||||
dbot.strings = JSON.parse(fs.readFileSync('strings.json', 'utf-8'));
|
|
||||||
dbot.reloadModules();
|
dbot.reloadModules();
|
||||||
event.reply(dbot.t('reload'));
|
event.reply(dbot.t('reload'));
|
||||||
},
|
},
|
||||||
|
7
run.js
7
run.js
@ -151,11 +151,16 @@ DBot.prototype.reloadModules = function() {
|
|||||||
this.modules = [];
|
this.modules = [];
|
||||||
this.commands = {};
|
this.commands = {};
|
||||||
this.commandMap = {}; // Map of which commands belong to which modules
|
this.commandMap = {}; // Map of which commands belong to which modules
|
||||||
this.strings = {};
|
|
||||||
this.usage = {};
|
this.usage = {};
|
||||||
this.timers.clearTimers();
|
this.timers.clearTimers();
|
||||||
this.save();
|
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_
|
// Enforce having command. it can still be reloaded, but dbot _will not_
|
||||||
// function without it, so not having it should be impossible
|
// function without it, so not having it should be impossible
|
||||||
if(!this.moduleNames.include("command")) {
|
if(!this.moduleNames.include("command")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user