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) <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-18 10:55:56 -05:00
parent 90189aab6c
commit 7f7732b441
+8 -1
View File
@@ -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