[calendar] fix bot

This commit is contained in:
Andrea 2022-06-05 10:42:05 +02:00
parent 33117d54dc
commit 49e7346713
1 changed files with 17 additions and 18 deletions

View File

@ -84,10 +84,6 @@ const timer = ms => new Promise( res => setTimeout(res, ms));
const { day, message, image } = await (await fetch(locales[locale].url + '/api/calendar/today')).json(); const { day, message, image } = await (await fetch(locales[locale].url + '/api/calendar/today')).json();
console.log('<<<', message, '>>>'); console.log('<<<', message, '>>>');
if (!message) { continue; } if (!message) { continue; }
} catch (e) {
console.error(e);
continue;
}
fs.writeFileSync(imageTmpPath, Buffer.from(await (await fetch(image)).arrayBuffer()), {encoding: 'binary'}); fs.writeFileSync(imageTmpPath, Buffer.from(await (await fetch(image)).arrayBuffer()), {encoding: 'binary'});
let imageStream = null; let imageStream = null;
@ -105,5 +101,8 @@ const timer = ms => new Promise( res => setTimeout(res, ms));
console.log(postId); console.log(postId);
lastPostId[publisher] = postId; lastPostId[publisher] = postId;
} }
} catch (e) {
console.error(e);
}
} }
})(); })();