Every completed mission reaches Telegram: a paid find marks itself posted, a two-minute sweep posts any paid find not yet posted (pre-live gate, Telegram down, restart), HUNT_POST_SINCE keeps rehearsal finds quiet

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-21 07:20:16 -05:00
parent 6d0e313bf6
commit 0ba2486c95
2 changed files with 20 additions and 2 deletions
+6 -1
View File
@@ -79,6 +79,11 @@ function payable() {
for (const p of all.filter(p => p.status === 'queued').sort((a, b) => a.at - b.at)) { if (p.pol <= room) { room -= p.pol; out.push(p); } else break; }
return out;
}
// paid drips whose find has not been posted yet (found at or after `since`), oldest paid first
function unposted(since, limit) {
return store.read('payouts', []).filter(p => p.status === 'paid' && p.tx && !p.posted && (p.at || 0) >= (since || 0))
.sort((a, b) => (a.paidAt || a.at) - (b.paidAt || b.at)).slice(0, Math.max(1, limit || 15));
}
function mark(id, patch) { return store.update('payouts', [], all => { const p = all.find(x => x.id === id); if (p) Object.assign(p, patch); return all; }); }
// the day's pool: committed POL (paid, sent, due, queued; never failed) against the cap, and when it
@@ -102,4 +107,4 @@ function totals() {
return { paid: paid.length, pol: Math.round(paid.reduce((n, p) => n + p.pol, 0) * 10000) / 10000, queued: all.filter(p => p.status === 'queued').length, today: paidToday(ctDay()), hunters: new Set(paid.map(p => p.memberId)).size };
}
module.exports = { settings, setSettings, draw, grant, completed, doneToday, payable, mark, ledger, mine, totals, paidToday, pool, nextResetAt, daily, findsToday };
module.exports = { settings, setSettings, draw, grant, completed, doneToday, payable, mark, ledger, mine, totals, paidToday, pool, nextResetAt, daily, findsToday, unposted };