Sponsor autopilot (sponsorpilot.js, same module as InstantAdPay's): writes to a named sponsor's free directs as the sponsor; paced, four messages at most, a reply stops it; switch pilotOn default off (Marty 2026-11-25)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,7 @@ const chatbot = require('./chatbot');
|
||||
const netkb = require('./netkb'); // the shared network KB on the hub; suggest() for the Help screen (2026-11-16)
|
||||
const kb = require('./kb'); // the assistant's knowledge base: Admin > Knowledge base, seeded from chatbot.js CANNED + kb-seed.js (2026-10-20)
|
||||
const coach = require('./coach'); // coaching view, nudges, digest, prospects, link stats
|
||||
const sponsorpilot = require('./sponsorpilot'); // sponsor autopilot (2026-11-25): switch pilotOn, default off
|
||||
const tank = require('./tank'); // holding tank: unsponsored free members, adoptions, pay-it-forward
|
||||
const tankready = require('./tankready'); // holding-tank readiness from the network hub (2026-11-18): entry reason, stage, heat, last action on the tank cards. No mail.
|
||||
const legacy = require('./legacy'); // Faucet Wave / Tier One Ads bridge: welcome-back credits for listed emails
|
||||
@@ -878,6 +879,13 @@ async function boot() {
|
||||
setInterval(() => tank.sweep().catch(e => console.error('tank sweep', e.message)), 60 * 60 * 1000); // adoptions past their 7-day window
|
||||
burner.init({ chain, ads, accounts });
|
||||
if (OUTBOUND_MAIL) { // the stall nudges are a mailing loop; do not even start it when mail is off
|
||||
// sponsor autopilot (sponsorpilot.js, 2026-11-25): writes to the named sponsors' free directs as the sponsor, paced, 8 AM to 8 PM CT; nothing while pilotOn is off
|
||||
{ let spamP = { at: 0, set: new Set() }; const spamSetP = () => { if (Date.now() - spamP.at > 60000) { try { spamP = { at: Date.now(), set: new Set((((spamscan.view() || {}).last || {}).candidates || []).map(c => String(c.email || '').toLowerCase())) }; } catch (e) { spamP = { at: Date.now(), set: new Set() }; } } return spamP.set; };
|
||||
await sponsorpilot.init({ dataDir: DATA_DIR, db, accounts, messages, mailer, tank, siteConfig, brand: { name: 'LinkSpin', url: 'https://linkspin.app/my' }, online: ls => chatOnline(ls), unsubUrl: em => drip.unsubUrl(em),
|
||||
hooks: { claim: key => marks.claim(key),
|
||||
excludedPerson: async em => { if (spamSetP().has(em)) return 'spam scan'; const d = String(em).split('@')[1] || ''; const fix = require('./emailcheck').suggestDomain(d); if (fix && fix !== d) return 'mistyped email domain'; if (erase.isErased(em)) return 'erased'; if (await drip.isUnsubscribed(em).catch(() => false)) return 'unsubscribed'; return null; },
|
||||
notify: async text => { const sc = siteConfig(); const chat = String(sc.telegramAdminChatId || '1289244227').trim(); if (sc.telegramBotToken) return telegramSend(chat, text); } } }); }
|
||||
setInterval(() => sponsorpilot.tick().then(r => { if (r && r.sent) console.log('sponsorpilot sent', r.sent); }).catch(e => console.error('sponsorpilot', e.message)), 60 * 1000);
|
||||
setTimeout(() => coach.nudgeTick().catch(e => console.error('coach', e.message)), 90 * 1000);
|
||||
setInterval(() => coach.nudgeTick().catch(e => console.error('coach', e.message)), 60 * 60 * 1000);
|
||||
}
|
||||
@@ -941,6 +949,7 @@ function siteConfig() {
|
||||
noPayoutIds: '', // LinkSpin member ids differ from InstantAdPay's (IAP #25 = Jim's compromised wallet; LinkSpin #25 is a real member, cleared 2026-10-15). Positions kept for linkage only (compromised wallets): no buys signed from them, no new joins routed under them or their upline chain (Marty, 2026-09-14)
|
||||
leaderboardWeeklyPrize: '', leaderboardMonthlyPrize: '', leaderboardWeeklyCredits: '1000,500,250', leaderboardMonthlyCredits: '5000,2500,1000', leaderboardAnnounceGeneral: '1', // referral contest prizes (text shown on /leaderboard; credits granted to the winner automatically at rollover)
|
||||
loginAdEveryHours: 3, // login ad: shown again on the next member page once the last finished view is this many hours old (Marty 2026-11-15)
|
||||
...sponsorpilot.DEFAULTS, // sponsor autopilot (sponsorpilot.js, Marty 2026-11-25): master switch pilotOn '0', pilotSponsors = usernames
|
||||
tankAdoptCap: 10, // holding tank: people one adopter may hold at one time (not yet switched on payouts), Marty 2026-11-11
|
||||
legacyCreditsAdvertiser: 500, legacyCreditsEarner: 150, // welcome-back credits for listed Faucet Wave / Tier One Ads emails arriving via /from/<brand>
|
||||
geoTier1: '', // comma-separated ISO country codes; empty = built-in default (US, CA, GB, AU, NZ, IE, DE, FR, NL, SE, NO, DK, FI, CH, AT, BE)
|
||||
@@ -2797,6 +2806,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const r = await tank.recordGift(s.email, b.email, b.tx, b.pol);
|
||||
return json(res, r.error ? 400 : 200, r);
|
||||
}
|
||||
if (p === '/api/admin/pilot' && req.method === 'GET') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); return json(res, 200, await sponsorpilot.view()); } // sponsor autopilot: read-only state + the messages
|
||||
if (p === '/api/admin/tank/grant' && req.method === 'POST') { // admin: assign N real BTC4Hits imports to an adopter on top of the cap (Marty 2026-11-11)
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
const b = await readBody(req); const a = await adminMember.resolve(String(b.adopter || '')); if (!a) return json(res, 404, { error: 'No member matches that adopter.' });
|
||||
@@ -3799,6 +3809,7 @@ const server = http.createServer(async (req, res) => {
|
||||
return json(res, 403, { error: 'They are not accepting messages from you right now.' });
|
||||
const memberId = s.memberId || await auth.refreshMemberId(s);
|
||||
const msg = await messages.sendChat(memberId, me, to, text);
|
||||
sponsorpilot.onChat(me, to, text).catch(() => {}); // a referral answering an automatic sponsor message: stop the automatics, ping the owner once
|
||||
// email only when they are offline AND I have not messaged them in ~10 min (no mid-chat spam)
|
||||
try {
|
||||
if (mailer.hasKey() && !chatOnline(target.lastSeen)) {
|
||||
|
||||
Reference in New Issue
Block a user