mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
remove unecessary code from module loading, fix [#432]
This commit is contained in:
parent
ae22060fcb
commit
090f15e738
15
run.js
15
run.js
@ -157,7 +157,6 @@ DBot.prototype.reloadModules = function() {
|
|||||||
var name, moduleDir, config;
|
var name, moduleDir, config;
|
||||||
for(i=0;i<moduleNames.length;i++) {
|
for(i=0;i<moduleNames.length;i++) {
|
||||||
name = moduleNames[i];
|
name = moduleNames[i];
|
||||||
console.log('iterating ' + name);
|
|
||||||
this.status[name] = true;
|
this.status[name] = true;
|
||||||
moduleDir = './modules/' + name + '/';
|
moduleDir = './modules/' + name + '/';
|
||||||
try {
|
try {
|
||||||
@ -165,14 +164,7 @@ DBot.prototype.reloadModules = function() {
|
|||||||
delete require.cache[cacheKey];
|
delete require.cache[cacheKey];
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
this.status[name] = 'Error loading module: ' + err + ' ' + err.stack.split('\n')[2].trim();
|
this.status[name] = 'Error loading module: ' + err + ' ' + err.stack.split('\n')[2].trim();
|
||||||
return;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
var webKey = require.resolve(moduleDir + 'web');
|
|
||||||
} catch(err) { }
|
|
||||||
if(webKey) {
|
|
||||||
delete require.cache[webKey];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the module config data
|
// Load the module config data
|
||||||
@ -228,7 +220,10 @@ DBot.prototype.reloadModules = function() {
|
|||||||
var module = rawModule.fetch(this);
|
var module = rawModule.fetch(this);
|
||||||
this.rawModules.push(rawModule);
|
this.rawModules.push(rawModule);
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.log(err);
|
var stack = err.stack.split('\n')[2].trim();
|
||||||
|
this.status[name] = 'Error loading module: ' + err + ' ' + stack;
|
||||||
|
console.log('Error loading module: ' + err + ' ' + stack);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.name = name;
|
module.name = name;
|
||||||
|
Loading…
Reference in New Issue
Block a user