3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 14:29:29 +01:00

Move onDestroy to the right place

This commit is contained in:
Luke Slater 2011-09-14 17:30:39 +01:00
parent 0f0e935c36
commit 1621e22ddd
2 changed files with 6 additions and 7 deletions

View File

@ -12,7 +12,6 @@ var webInterface = function(dbot) {
app.get('/', function(req, res) {
res.render('index', { });
console.log('test');
});
app.listen(1337);

12
run.js
View File

@ -30,6 +30,12 @@ DBot.prototype.save = function() {
};
DBot.prototype.reloadModules = function() {
this.modules.each(function(module) {
if(module.onDestroy) {
module.onDestroy();
}
});
this.rawModules = [];
this.modules = [];
this.commands = {};
@ -39,12 +45,6 @@ DBot.prototype.reloadModules = function() {
require.cache[path] = undefined;
require('./snippets');
this.modules.each(function(module) {
if(module.onDestroy) {
module.onDestroy();
}
});
this.moduleNames.each(function(name) {
var cacheKey = require.resolve('./modules/' + name);
require.cache[cacheKey] = undefined; // TODO: snippet to remove element properly