Proof channel: one compact line per event (payouts + upgrades), HTML link, no hashtags
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -160,12 +160,13 @@ function sendTelegram(text, topicId, replyMarkup) {
|
|||||||
}
|
}
|
||||||
// Same bot, any chat: the team forum, or the public payment-proof channel
|
// Same bot, any chat: the team forum, or the public payment-proof channel
|
||||||
// (config.telegramProofChatId — the bot just has to be an admin there).
|
// (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();
|
const c = getConfig();
|
||||||
if (!c.telegramBotToken || !chatId) return;
|
if (!c.telegramBotToken || !chatId) return;
|
||||||
// No link previews: payout/team-build posts carry Polygonscan links, and the
|
// No link previews: payout/team-build posts carry Polygonscan links, and the
|
||||||
// preview card tripled the height of every message in the group.
|
// preview card tripled the height of every message in the group.
|
||||||
const payload = { chat_id: chatId, text, disable_web_page_preview: true };
|
const payload = { chat_id: chatId, text, disable_web_page_preview: true };
|
||||||
|
if (parseMode) payload.parse_mode = parseMode;
|
||||||
const thread = topicId;
|
const thread = topicId;
|
||||||
if (thread && /^[0-9]+$/.test(String(thread))) payload.message_thread_id = Number(thread);
|
if (thread && /^[0-9]+$/.test(String(thread))) payload.message_thread_id = Number(thread);
|
||||||
if (replyMarkup) payload.reply_markup = replyMarkup;
|
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
|
// proof + a call to action, no internal/contact detail. CTA destination is
|
||||||
// config.recruitCtaUrl (e.g. Marty's live dashboard as proof-first landing);
|
// config.recruitCtaUrl (e.g. Marty's live dashboard as proof-first landing);
|
||||||
// defaults to the home page.
|
// 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, '<').replace(/>/g, '>');
|
||||||
|
const rx = evt.tx ? ` · <a href="https://polygonscan.com/tx/${evt.tx}">Polygonscan ↗</a>` : '';
|
||||||
|
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 = `💸 <b>#${evt.toId}</b> got paid <b>${evt.pol.toFixed(2)} POL</b> · ${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 `⬆️ <b>#${evt.id}</b> upgraded to <b>${esc(evt.levelName)}</b>${tools ? ` · unlocked ${esc(tools)}` : ''}${rx}`;
|
||||||
|
}
|
||||||
|
if (evt.type === 'registered') return `📈 <b>#${evt.id}</b> joined under #${evt.referrerId} (${esc(evt.tierName || 'Premium')})${rx}`;
|
||||||
|
return '';
|
||||||
|
}
|
||||||
function recruitMsg(evt, homeOverride) {
|
function recruitMsg(evt, homeOverride) {
|
||||||
const home = String(homeOverride || getConfig().recruitCtaUrl || 'rmcircle.team').replace(/^https?:\/\//, ''), tags = '#RMCircle #Polygon #Crypto';
|
const home = String(homeOverride || getConfig().recruitCtaUrl || 'rmcircle.team').replace(/^https?:\/\//, ''), tags = '#RMCircle #Polygon #Crypto';
|
||||||
if (evt.type === 'payout') {
|
if (evt.type === 'payout') {
|
||||||
@@ -1739,15 +1762,11 @@ chain.startIndexer(evt=>{
|
|||||||
// company payment-proof channel: the recruiting copy plus the Polygonscan
|
// company payment-proof channel: the recruiting copy plus the Polygonscan
|
||||||
// receipt, posted by the SAME bot to a separate chat. Payouts only unless
|
// 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.
|
// telegramProofEvents is 'all'. Fires only when a proof chat id is set.
|
||||||
if(c.telegramProofChatId && (evt.type==='payout' || String(c.telegramProofEvents||'payouts')==='all')){
|
// telegramProofEvents: 'payouts' | 'payouts+upgrades' (default) | 'all'
|
||||||
// company channel: plain team site, never a personal link (Marty 2026-09-09)
|
if(c.telegramProofChatId){
|
||||||
const proofHome=String(c.telegramProofCtaUrl||'rmcircle.team').replace(/^https?:\/\//,'');
|
const mode=String(c.telegramProofEvents||'payouts+upgrades');
|
||||||
const pm=recruitMsg(evt, proofHome);
|
const want=evt.type==='payout' || (evt.type==='upgraded' && mode!=='payouts') || (evt.type==='registered' && mode==='all');
|
||||||
if(pm){ const cta='https://'+proofHome;
|
if(want){ const pm=proofMsg(evt); if(pm) sendTelegramTo(c.telegramProofChatId, pm, c.telegramProofTopicId||null, null, 'HTML'); }
|
||||||
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'}]]}); }
|
|
||||||
}
|
}
|
||||||
// admin email alert — same team-gated events, so deep-leg action still surfaces
|
// admin email alert — same team-gated events, so deep-leg action still surfaces
|
||||||
if(c.teamAlertEmail){
|
if(c.teamAlertEmail){
|
||||||
|
|||||||
Reference in New Issue
Block a user