diff --git a/main.js b/main.js index 9d12ae3..b5bf0e2 100644 --- a/main.js +++ b/main.js @@ -64,7 +64,7 @@ async function fetchNewPosts() { let newTimestampId = 0; - reversed.forEach(item => { + for(let item of reversed) { const currentTimestampId = Date.parse(item.published); if(currentTimestampId > newTimestampId) { @@ -73,7 +73,9 @@ async function fetchNewPosts() { if(currentTimestampId > lastProcessedPostId && lastProcessedPostId != 0) { const text = removeHtmlTags(item.object.content); - postToBluesky(text); + await postToBluesky(text); + lastProcessedPostId = newTimestampId; + await saveLastProcessedPostId(); } })