diff --git a/lib/index.js b/lib/index.js index 9c102d4..ec205ec 100644 --- a/lib/index.js +++ b/lib/index.js @@ -58,7 +58,7 @@ function unloadplugin(pluginname, pluginpath) { } } -reloadplugin = (event, filename, pluginpath) => { +function reloadplugin(event, filename, pluginpath) { if (!/\.js$/.test(filename)) { return } if (!cfg.fsTimeout) { console.info(event, filename) @@ -85,7 +85,7 @@ reloadplugin = (event, filename, pluginpath) => { // console.log('file.js %s event', event) } -fs.watch('./lib/plugins', reloadplugin) +fs.watch('./lib/plugins', { recursive: true }, reloadplugin) cfg.bot = bot // TODO better name, or switch to array