debug duplicate posts

master
adb 3 years ago
parent 29eb393717
commit 1e25cba824

@ -16,9 +16,10 @@ export function loadData(path) {
}
}
export function getStat(path) {
fs.stat(path, (err, stat) => {
if(err == null) return true;
if(err.code === 'ENOENT') return false;
return err.code;
});
try {
return fs.existsSync(path) === true;
} catch(err) {
console.error(err)
return false;
}
}

@ -20,7 +20,7 @@ export class mastodonMemeBot {
return;
}
let filepath = `./media/${sub.url.split(/[/]+/).pop()}`;
if (getStat(filepath) === true) {
if (getStat(filepath)) {
console.log("post already exists, fetching new sub");
this.postRandomMeme(callback);
return;

Loading…
Cancel
Save