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
|
persistent: true
|
||||||
});
|
});
|
||||||
|
|
||||||
watcher.on('all', (event, path) => {
|
|
||||||
console.log(event, path);
|
|
||||||
});
|
|
||||||
|
|
||||||
watched = [];
|
watched = [];
|
||||||
watcher.on("add", async (filePath, stats) => {
|
watcher.on("add", async (filePath, stats) => {
|
||||||
if (startup) return;
|
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
|
// Setup Discord bot
|
||||||
client.on("ready", async () => {
|
client.on("ready", async () => {
|
||||||
console.log(`Logged in as ${client.user.tag}!`);
|
console.log(`Logged in as ${client.user.tag}!`);
|
||||||
|
|
Loading…
Reference in a new issue