From 7f7732b441ee63b65242259e6f728a219e3ecc8d Mon Sep 17 00:00:00 2001 From: martbost Date: Fri, 18 Sep 2026 10:55:56 -0500 Subject: [PATCH] Log the Telegram message_id we get back, to settle which copy is ours RM Circle has one indexer, one sender, one proof-channel send site, and the instrumented log shows it sending each payout exactly once. Yet duplicates keep appearing in the channel, so a second sender with the same bot token is posting the other copy. Recording the message_id Telegram assigns makes the next occurrence decisive: if both visible copies carry ids this process logged, it sent twice; if only one does, the other sender is external and the id gap says roughly when it posted. Co-Authored-By: Claude Opus 5 (1M context) --- server.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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