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:
parent
0f0e935c36
commit
1621e22ddd
@ -12,7 +12,6 @@ var webInterface = function(dbot) {
|
|||||||
|
|
||||||
app.get('/', function(req, res) {
|
app.get('/', function(req, res) {
|
||||||
res.render('index', { });
|
res.render('index', { });
|
||||||
console.log('test');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.listen(1337);
|
app.listen(1337);
|
||||||
|
12
run.js
12
run.js
@ -30,6 +30,12 @@ DBot.prototype.save = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
DBot.prototype.reloadModules = function() {
|
DBot.prototype.reloadModules = function() {
|
||||||
|
this.modules.each(function(module) {
|
||||||
|
if(module.onDestroy) {
|
||||||
|
module.onDestroy();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.rawModules = [];
|
this.rawModules = [];
|
||||||
this.modules = [];
|
this.modules = [];
|
||||||
this.commands = {};
|
this.commands = {};
|
||||||
@ -39,12 +45,6 @@ DBot.prototype.reloadModules = function() {
|
|||||||
require.cache[path] = undefined;
|
require.cache[path] = undefined;
|
||||||
require('./snippets');
|
require('./snippets');
|
||||||
|
|
||||||
this.modules.each(function(module) {
|
|
||||||
if(module.onDestroy) {
|
|
||||||
module.onDestroy();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.moduleNames.each(function(name) {
|
this.moduleNames.each(function(name) {
|
||||||
var cacheKey = require.resolve('./modules/' + name);
|
var cacheKey = require.resolve('./modules/' + name);
|
||||||
require.cache[cacheKey] = undefined; // TODO: snippet to remove element properly
|
require.cache[cacheKey] = undefined; // TODO: snippet to remove element properly
|
||||||
|
Loading…
Reference in New Issue
Block a user