feat: 🔨 make `fs.watch` recursive, so it `reloadplugin` works also on directories

master
jay 3 years ago
parent 6046123074
commit e0c477a46f
  1. 4
      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

Loading…
Cancel
Save