forked from GitHub/dbot
added try/catch for no usage/string info, moved module load error back to default stringspace
This commit is contained in:
parent
fbf4242d66
commit
1f2c7fa835
@ -64,11 +64,5 @@
|
||||
"spanish": "Cerrado la categoría: {category}",
|
||||
"na'vi": "{category}ìri oel 'upxareti fmoli",
|
||||
"welsh": "Categori wedi cloi: {category}"
|
||||
},
|
||||
"module_load_error": {
|
||||
"english": "Failed to load module: {moduleName}",
|
||||
"spanish": "No se pudó cargar el módulo: {moduleName}",
|
||||
"na'vi": "Oeru Oel {moduleName}it sung.",
|
||||
"welsh": "Wedi methu a llwytho modiwl: {moduleName}"
|
||||
}
|
||||
}
|
||||
|
36
run.js
36
run.js
@ -200,27 +200,35 @@ DBot.prototype.reloadModules = function() {
|
||||
}
|
||||
|
||||
// Load the module usage data
|
||||
var usage = JSON.parse(fs.readFileSync(moduleDir + 'usage.json', 'utf-8'));
|
||||
for(key in usage) {
|
||||
if(usage.hasOwnProperty(key)) {
|
||||
if(this.usage.hasOwnProperty(key)) {
|
||||
console.log('Usage key clash for ' + key + ' in ' + name);
|
||||
} else {
|
||||
this.usage[key] = usage[key];
|
||||
try {
|
||||
var usage = JSON.parse(fs.readFileSync(moduleDir + 'usage.json', 'utf-8'));
|
||||
for(key in usage) {
|
||||
if(usage.hasOwnProperty(key)) {
|
||||
if(this.usage.hasOwnProperty(key)) {
|
||||
console.log('Usage key clash for ' + key + ' in ' + name);
|
||||
} else {
|
||||
this.usage[key] = usage[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(err) {
|
||||
// Invalid or no usage info
|
||||
}
|
||||
|
||||
// Load the module string data
|
||||
var strings = JSON.parse(fs.readFileSync(moduleDir + 'strings.json', 'utf-8'));
|
||||
for(key in strings) {
|
||||
if(strings.hasOwnProperty(key)) {
|
||||
if(this.strings.hasOwnProperty(key)) {
|
||||
console.log('Strings key clash for ' + key + ' in ' + name);
|
||||
} else {
|
||||
this.strings[key] = strings[key];
|
||||
try {
|
||||
var strings = JSON.parse(fs.readFileSync(moduleDir + 'strings.json', 'utf-8'));
|
||||
for(key in strings) {
|
||||
if(strings.hasOwnProperty(key)) {
|
||||
if(this.strings.hasOwnProperty(key)) {
|
||||
console.log('Strings key clash for ' + key + ' in ' + name);
|
||||
} else {
|
||||
this.strings[key] = strings[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(err) {
|
||||
// Invalid or no string info
|
||||
}
|
||||
|
||||
this.modules.push(module);
|
||||
|
@ -5,6 +5,12 @@
|
||||
"na'vi": "Srake sweylu nga pamrel sivi: ",
|
||||
"welsh": "A oeddech chi'n feddwl: "
|
||||
},
|
||||
"module_load_error": {
|
||||
"english": "Failed to load module: {moduleName}",
|
||||
"spanish": "No se pudó cargar el módulo: {moduleName}",
|
||||
"na'vi": "Oeru Oel {moduleName}it sung.",
|
||||
"welsh": "Wedi methu a llwytho modiwl: {moduleName}"
|
||||
},
|
||||
"url": {
|
||||
"english": "http://{host}:{port}/{path}"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user