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

This commit is contained in:
jay 2021-04-27 11:47:25 +05:00
parent 6046123074
commit e0c477a46f

View File

@ -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