mirror of
https://github.com/reality/dbot.git
synced 2024-12-24 19:52:36 +01:00
add ability to unload a module whose file has been deleted
This commit is contained in:
parent
dfa1e40a8b
commit
6a968d5945
@ -173,8 +173,10 @@ var commands = function(dbot) {
|
||||
var moduleName = event.params[1];
|
||||
if(_.include(moduleNames, moduleName)) {
|
||||
var moduleDir = '../' + moduleName + '/';
|
||||
var cacheKey = require.resolve(moduleDir + moduleName);
|
||||
delete require.cache[cacheKey];
|
||||
try {
|
||||
var cacheKey = require.resolve(moduleDir + moduleName);
|
||||
delete require.cache[cacheKey];
|
||||
} catch(err) { }
|
||||
dbot.config.moduleNames = _.without(dbot.config.moduleNames, moduleName);
|
||||
dbot.reloadModules();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user