diff --git a/server.js b/server.js index 75e90d9..ca3e727 100644 --- a/server.js +++ b/server.js @@ -160,12 +160,13 @@ function sendTelegram(text, topicId, replyMarkup) { } // Same bot, any chat: the team forum, or the public payment-proof channel // (config.telegramProofChatId โ€” the bot just has to be an admin there). -function sendTelegramTo(chatId, text, topicId, replyMarkup) { +function sendTelegramTo(chatId, text, topicId, replyMarkup, parseMode) { const c = getConfig(); if (!c.telegramBotToken || !chatId) return; // 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 }; + if (parseMode) payload.parse_mode = parseMode; const thread = topicId; if (thread && /^[0-9]+$/.test(String(thread))) payload.message_thread_id = Number(thread); if (replyMarkup) payload.reply_markup = replyMarkup; @@ -179,6 +180,28 @@ function sendTelegramTo(chatId, text, topicId, replyMarkup) { // proof + a call to action, no internal/contact detail. CTA destination is // config.recruitCtaUrl (e.g. Marty's live dashboard as proof-first landing); // defaults to the home page. +// Company payment-proof channel: ONE compact line per event, team-build style, +// no hashtags, no join CTA (the pinned daily snapshot carries how-to-join). +// HTML parse mode so the receipt is a short "Polygonscan" link, not a raw hash. +function proofMsg(evt) { + const esc = t => String(t).replace(/&/g, '&').replace(//g, '>'); + const rx = evt.tx ? ` ยท Polygonscan โ†—` : ''; + if (evt.type === 'payout') { + const why = evt.kind === 'upline' + ? `${evt.gen ? `Gen ${evt.gen} ` : ''}upgrade pass-up from #${evt.fromId}` + : `referral reward from #${evt.fromId}`; + let t = `๐Ÿ’ธ #${evt.toId} got paid ${evt.pol.toFixed(2)} POL ยท ${esc(why)}${rx}`; + const tools = evt.kind === 'upline' ? suiteTools.unlockText(0, evt.levelName, getConfig()) : ''; + if (tools) t += `\n๐Ÿงฐ #${evt.fromId} reached ${esc(evt.levelName)} and unlocked ${esc(tools)}`; + return t; + } + if (evt.type === 'upgraded') { + const tools = suiteTools.unlockText(evt.level, evt.levelName, getConfig()); + return `โฌ†๏ธ #${evt.id} upgraded to ${esc(evt.levelName)}${tools ? ` ยท unlocked ${esc(tools)}` : ''}${rx}`; + } + if (evt.type === 'registered') return `๐Ÿ“ˆ #${evt.id} joined under #${evt.referrerId} (${esc(evt.tierName || 'Premium')})${rx}`; + return ''; +} function recruitMsg(evt, homeOverride) { const home = String(homeOverride || getConfig().recruitCtaUrl || 'rmcircle.team').replace(/^https?:\/\//, ''), tags = '#RMCircle #Polygon #Crypto'; if (evt.type === 'payout') { @@ -1739,15 +1762,11 @@ chain.startIndexer(evt=>{ // company payment-proof channel: the recruiting copy plus the Polygonscan // receipt, posted by the SAME bot to a separate chat. Payouts only unless // telegramProofEvents is 'all'. Fires only when a proof chat id is set. - if(c.telegramProofChatId && (evt.type==='payout' || String(c.telegramProofEvents||'payouts')==='all')){ - // company channel: plain team site, never a personal link (Marty 2026-09-09) - const proofHome=String(c.telegramProofCtaUrl||'rmcircle.team').replace(/^https?:\/\//,''); - const pm=recruitMsg(evt, proofHome); - if(pm){ const cta='https://'+proofHome; - sendTelegramTo(c.telegramProofChatId, pm+(evt.tx?` - -๐Ÿ”— Proof on Polygonscan: https://polygonscan.com/tx/${evt.tx}`:''), c.telegramProofTopicId||null, - {inline_keyboard:[[{text:'๐Ÿš€ Get Started โ€” rmcircle.team',url:cta+(cta.includes('?')?'&':'?')+'utm_source=tgproof'}]]}); } + // telegramProofEvents: 'payouts' | 'payouts+upgrades' (default) | 'all' + if(c.telegramProofChatId){ + const mode=String(c.telegramProofEvents||'payouts+upgrades'); + const want=evt.type==='payout' || (evt.type==='upgraded' && mode!=='payouts') || (evt.type==='registered' && mode==='all'); + if(want){ const pm=proofMsg(evt); if(pm) sendTelegramTo(c.telegramProofChatId, pm, c.telegramProofTopicId||null, null, 'HTML'); } } // admin email alert โ€” same team-gated events, so deep-leg action still surfaces if(c.teamAlertEmail){