Remove file from watched when deleted
This commit is contained in:
parent
a40b91282a
commit
7728fab3f3
8
index.js
8
index.js
|
@ -94,10 +94,6 @@ const watcher = chokidar.watch(config.freepbx.voicemaildir, {
|
|||
persistent: true
|
||||
});
|
||||
|
||||
watcher.on('all', (event, path) => {
|
||||
console.log(event, path);
|
||||
});
|
||||
|
||||
watched = [];
|
||||
watcher.on("add", async (filePath, stats) => {
|
||||
if (startup) return;
|
||||
|
@ -139,6 +135,10 @@ watcher.on("add", async (filePath, stats) => {
|
|||
})
|
||||
});
|
||||
|
||||
watcher.on('unlink', (filePath) => {
|
||||
watched.splice(watched.indexOf(filePath), 1);
|
||||
});
|
||||
|
||||
// Setup Discord bot
|
||||
client.on("ready", async () => {
|
||||
console.log(`Logged in as ${client.user.tag}!`);
|
||||
|
|
Loading…
Reference in a new issue