diff --git a/server.js b/server.js index bb6f955..63162b9 100644 --- a/server.js +++ b/server.js @@ -1118,6 +1118,14 @@ const server = http.createServer(async (req, res) => { if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' }); const b = await readBody(req); const r = await tank.adopt(s.email, b.who, b.note); + if (r.ok) { // tell the payments topic who picked whom up (Marty, 2026-09-12) + try { + const sc = siteConfig(); + const clean = t => String(t || '').replace(/[<>&]/g, ''); + if (sc.telegramBotToken && sc.telegramEchoChatId) + telegramSend(sc.telegramEchoChatId, '\u{1F91D} InstantAdPay \u00b7 ' + clean(r.adopterName) + ' picked up ' + clean(r.adopteeName) + ' from the holding tank and is now their sponsor', sc.telegramEchoTopicId).catch(() => {}); + } catch (e) {} + } return json(res, r.error ? 400 : 200, r); } if (p === '/api/my/tank/release' && req.method === 'POST') { diff --git a/tank.js b/tank.js index 3bdef43..f5a4043 100644 --- a/tank.js +++ b/tank.js @@ -120,7 +120,7 @@ async function adopt(adopterEmail, who, note) { 'You joined InstantAdPay without a sponsor. ' + nameOf(me) + ' has picked you up from the holding tank and is your sponsor now, which means a real person to walk you through the first steps.\n\nTheir message:\n\n' + text + '\n\nReply in your member area: ' + siteUrl + '/my#messages\n\nInstantAdPay'); } catch (err) {} } - return { ok: true, adoption: ad, name: target.name }; + return { ok: true, adoption: ad, name: target.name, adopterName: nameOf(me), adopteeName: target.name }; } // pay it forward: give one of your own free referrals to the tank