Launch bonus: pay it automatically to the first referral home

Marty offered 5 POL to the first hunter who gets a referral all the way
through. It now pays itself: the bonus is written alongside the very first
bounty anyone earns, from the same faucet, and can never be written twice.

It sits outside the daily referral ceiling on purpose, because it is one
payment rather than a rate, and it announces itself to Telegram so the room
knows the race is over. While it is unclaimed the board card says so, and the
moment it is won the card stops advertising it.

Set refFirstBonusPol to 0 to retire it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-23 10:07:23 -05:00
parent 36ef50830c
commit 4cfe851e81
5 changed files with 24 additions and 5 deletions
+3 -1
View File
@@ -74,6 +74,8 @@ async function notifyOther(kind, p) {
if (kind === 'failed') return telegram('❌ <b>PolHunter</b> · drip to #' + p.memberId + ' failed: ' + p.error);
// a bounty is the one payout that advertises the mission itself, so it goes to the room
if (kind === 'referral') { const d = p.drip; return telegram('\u{1F91D} <b>PolHunter</b> · ' + (d.username ? '@' + d.username : '#' + d.memberId) + ' brought ' + d.ref.forName + ' in and they are hunting · <b>' + fmt(d.pol) + ' POL</b> bounty on the way\n<a href="' + SITE + '">Bring yours</a>'); }
// Marty's launch bonus, paid once to whoever gets a referral all the way through first
if (kind === 'firstbonus') { const d = p.drip; return telegram('\u{1F947} <b>First referral home!</b> ' + (d.username ? '@' + d.username : '#' + d.memberId) + ' is the first to bring a hunter all the way through, so Marty’s <b>' + fmt(d.pol) + ' POL</b> bonus is theirs on top of the bounty.\nThat one is claimed. The mission is not — <a href="' + SITE + '">bring yours</a>.'); }
if (kind === 'prize') { const medal = ['\u{1F947}', '\u{1F948}', '\u{1F949}']; return telegram('\u{1F3C6} <b>PolHunter weekly prizes</b> for the week of ' + p.week + '\n' + p.winners.map(w => (medal[w.rank - 1] || '#' + w.rank) + ' ' + w.who + ' \u00b7 ' + w.finds + ' finds \u00b7 <b>' + fmt(w.prizePol) + ' POL</b>').join('\n') + '\n<a href="' + SITE + '/leaders">Leaderboard</a>'); }
return false;
}
@@ -253,7 +255,7 @@ const server = http.createServer(async (req, res) => {
// whoever brought this hunter gets paid for it: the bounty on their first find, a match while they are new
let refDrips = [];
try { refDrips = referrals.onFind(me, g.rec); } catch (e) { console.error('referral', e.message); }
for (const d of refDrips) if (d.ref.kind === 'bounty') notify('referral', { drip: d }).catch(() => {});
for (const d of refDrips) if (d.ref.kind === 'bounty' || d.ref.kind === 'first-bonus') notify(d.ref.kind === 'bounty' ? 'referral' : 'firstbonus', { drip: d }).catch(() => {});
// achievements unlocked by this find: told to the board, posted to Telegram (gated)
const unlocked = social.badgesFor(me.memberId).filter(b => !before.has(b.id));
for (const b of unlocked) notify('badge', { me, id: b.id }).catch(() => {});