feat: 🔨 make fs.watch
recursive, so it reloadplugin
works also on directories
This commit is contained in:
@@ -58,7 +58,7 @@ function unloadplugin(pluginname, pluginpath) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadplugin = (event, filename, pluginpath) => {
|
function reloadplugin(event, filename, pluginpath) {
|
||||||
if (!/\.js$/.test(filename)) { return }
|
if (!/\.js$/.test(filename)) { return }
|
||||||
if (!cfg.fsTimeout) {
|
if (!cfg.fsTimeout) {
|
||||||
console.info(event, filename)
|
console.info(event, filename)
|
||||||
@@ -85,7 +85,7 @@ reloadplugin = (event, filename, pluginpath) => {
|
|||||||
// console.log('file.js %s event', event)
|
// console.log('file.js %s event', event)
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.watch('./lib/plugins', reloadplugin)
|
fs.watch('./lib/plugins', { recursive: true }, reloadplugin)
|
||||||
|
|
||||||
cfg.bot = bot
|
cfg.bot = bot
|
||||||
// TODO better name, or switch to array
|
// TODO better name, or switch to array
|
||||||
|
Reference in New Issue
Block a user