Lightning payments through LNbits, wallets, passes, credits, the
entitlement resolver and priority lanes.
- internal/entitle: pure resolver (one-off, own pass, group pass, group
credits, own credits, free) with a table-driven suite and an invariant
check over every input combination
- internal/billing: wallets, append-only ledger with dedupe keys, stacking
passes, purchases, gift codes, referral reward
- LNbits client verified against v0.12.12 and v1.7.1 source
- Settlement by one conditional UPDATE: idempotent under any mix of
webhooks, polls and the check button. Webhooks are unsigned, so every
payment is confirmed with LNbits before it is credited
- Polling fallback, reconciliation of all unsettled invoices at startup,
late payments still honored, no expiry while LNbits is unreachable
- Charge, quota and job are written in one transaction; failed, cancelled
and undeliverable downloads are refunded exactly once
- Paid lane first with one slot of the fleet reserved for free users
- Daily download quota and daily volume cap, per-user and per-group rate
limits
- Bot: /buy /account /limits /credits /redeem /referral /donate, QR invoice
message that flips to paid, over-limit offer (passes or this file only),
deep links from groups, skip the queue
- Fake LNbits server for tests; end-to-end money flows including a payment
made while the core was down
Cashu redemption is behind an interface and not implemented.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Link in, card, download, send, in private chats and groups.
- cmd/core with an embedded download worker
- Telegram front end on telego v1.13.0 (Bot API 10.4): link card with
thumbnail and format buttons, one live status message, /dl /audio /thumb
/info /queue /cancel, group support with requester-only buttons
- Database backed queue: paid and free lanes, leases with heartbeats, one
automatic retry, cancel, queue position and wait estimate
- yt-dlp and ffprobe behind a Runner interface with classified, redacted
errors mapped to friendly messages
- SQLite via modernc with goose migrations, portable schema
- Local file storage behind a Storage interface
- go-i18n with an English catalog, no literal text in handlers
- Free tier limits enforced before queueing and again on the real file
- Bot token and webhook secret are stripped from all log output
- Tests: URL parsing, job lifecycle, worker, yt-dlp wrapper, and end to end
flows against a fake Bot API server; opt-in test with the real yt-dlp
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>