diff --git a/server.js b/server.js index b040376..8914c5c 100644 --- a/server.js +++ b/server.js @@ -210,7 +210,14 @@ function sendTelegramTo(chatId, text, topicId, replyMarkup, parseMode) { fetch(`https://api.telegram.org/bot${c.telegramBotToken}/sendMessage`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) - }).then(async r=>{ if(!r.ok) console.error('telegram sendMessage status', r.status, (await r.text().catch(()=>'')).slice(0,200)); }) + }).then(async r=>{ + const body = await r.json().catch(()=>null); + if(!r.ok || !body || !body.ok) { console.error('telegram sendMessage status', r.status, JSON.stringify(body).slice(0,200)); return; } + // Log the id Telegram assigns. When a duplicate shows up in a feed, this says which of + // the two copies is ours — and therefore whether this process sent twice or something + // else with the same bot token posted the second one. (2026-09-18 duplicate hunt.) + console.log('tg-ok', TG_INSTANCE, 'chat=' + chatId, 'message_id=' + (body.result && body.result.message_id)); + }) .catch(e=>console.error('telegram error', e.message)); } // Recruiting-framed version of a team event for the new-members topic: social