diff --git a/server.js b/server.js index 45be1fe..410e015 100644 --- a/server.js +++ b/server.js @@ -174,6 +174,8 @@ function sendTelegram(text, topicId, replyMarkup) { // to the same chat twice within the window. Distinct events never collide — every line // carries its own ids, amount and transaction hash. const TG_RECENT = new Map(); +// random per-process id: if two instances are posting, their sends carry different ids +const TG_INSTANCE = Math.random().toString(36).slice(2, 8); const TG_DEDUPE_MS = 15 * 60 * 1000; function tgSeenRecently(chatId, topicId, text) { const k = String(chatId) + '|' + String(topicId || '') + '|' + text; @@ -191,6 +193,13 @@ function sendTelegramTo(chatId, text, topicId, replyMarkup, parseMode) { console.warn('telegram duplicate suppressed:', String(text).replace(/\s+/g, ' ').slice(0, 90)); return; } + // TEMPORARY (2026-09-18): members are seeing payment lines twice. This process has a + // durable announce-once per on-chain event AND a send-level dedupe, and neither is firing, + // which means the second copy is not coming from here. Log every send with the instance id + // so "did WE send it twice, or is something else posting?" is answerable from the log + // instead of by deduction. Remove once the source is confirmed. + console.log('tg-send', TG_INSTANCE, 'chat=' + chatId, 'topic=' + (topicId || '-'), + JSON.stringify(String(text).replace(/\s+/g, ' ').slice(0, 70))); // No link previews: payout/team-build posts carry Polygonscan links, and the // preview card tripled the height of every message in the group. const payload = { chat_id: chatId, text, disable_web_page_preview: true };