Holding tank: adoption posts to the Telegram payments topic naming the sponsor
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -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} <b>InstantAdPay</b> \u00b7 <b>' + clean(r.adopterName) + '</b> picked up <b>' + clean(r.adopteeName) + '</b> 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') {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user