diff --git a/index.js b/index.js index 3316b2a..fd86b0c 100644 --- a/index.js +++ b/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}!`);