Cloudflare worker to watch RSS feeds and post updates to Discord webhooks

Add logging for feed check results and Discord responses

+4 -1
+4 -1
worker.js
··· 42 42 .filter(e => e.date && new Date(e.date) > lastDate) 43 43 .sort((a, b) => new Date(a.date) - new Date(b.date)); 44 44 45 + console.log(`Feed ${feedUrl}: ${entries.length} entries, ${newEntries.length} new (last: ${lastPosted || 'none'})`); 45 46 if (!newEntries.length) return; 46 47 47 48 for (const entry of newEntries) { ··· 80 81 81 82 async function postToDiscord(webhook, entry, feedUrl) { 82 83 const feedName = new URL(feedUrl).pathname.split('/')[1] || 'Feed'; 83 - await fetch(webhook, { 84 + const res = await fetch(webhook, { 84 85 method: 'POST', 85 86 headers: { 'Content-Type': 'application/json' }, 86 87 body: JSON.stringify({ ··· 94 95 }] 95 96 }) 96 97 }); 98 + const body = await res.text(); 99 + console.log(`Discord ${res.status}: ${body}`); 97 100 }