Phase 6: inline mode and docs
- Inline mode (INLINE_MODE_ENABLED): "@bot <link>" sends the cached file by file_id when the user's limits admit it without payment, and otherwise one result that opens the bot with /start il_<token> for the link. An inline send counts as a download when Telegram reports it chosen (inline feedback). The bot asks Telegram for inline_query and chosen_inline_result updates. - README, OPERATIONS and ARCHITECTURE describe the new flows, Stars, inline mode and every new setting; docs/SCREENS.md regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d64db03f21
commit
44d0905fa3
@@ -9,21 +9,41 @@ and in groups. Written in Go on top of yt-dlp.
|
||||
|
||||
## What works today
|
||||
|
||||
- Send a link in a private chat and get a card with title, thumbnail,
|
||||
duration and format buttons: Best, 720p, 480p, MP3, Thumbnail, Cancel.
|
||||
- Send a link in a private chat and get the file. The first link shows a
|
||||
card with title, thumbnail, duration and format buttons. After that the
|
||||
bot starts right away with the best quality that fits the user's limit,
|
||||
or with the default set in /quality ("Ask every time" brings the card
|
||||
back). Up to five links per message; a link sent a moment ago gets
|
||||
"already sent" with a button to send it again.
|
||||
- In groups: `/dl <link>`, or reply `/dl` to a message with a link. Buttons
|
||||
only work for the person who asked.
|
||||
- One status message, edited live: queued with position and wait,
|
||||
downloading with a progress bar, processing, sending, done.
|
||||
only work for the person who asked. Private chats are never quoted;
|
||||
groups are.
|
||||
- One status message per download, edited at most every 2.5 seconds:
|
||||
downloading with a progress bar (the queue position only when the wait
|
||||
is worth mentioning), processing, sending. Once the file is in the chat
|
||||
the status message is deleted, so the file is the only message left.
|
||||
- The file comes with a clean caption (title, uploader, length, a short
|
||||
source link without tracking parameters, optionally "via @bot"), a
|
||||
thumbnail, and buttons for the MP3, another quality, the thumbnail, and
|
||||
Delete. Errors come with a next step: try again, a smaller quality,
|
||||
upgrade, or the app. Passing failures are retried once by themselves.
|
||||
- A database backed queue with leases, one automatic retry and cancel.
|
||||
- Free tier limits: size, duration, daily quota, one active job.
|
||||
- Payments in sats over Lightning (LNbits): day, week and month passes,
|
||||
credits, "pay for this file only" and "skip the queue". Paid downloads
|
||||
get higher limits and a priority lane, with one slot always kept for free
|
||||
users.
|
||||
- Telegram Stars as a second way to pay for passes and credits, with
|
||||
prices of their own, in the chat and in the Mini App (`STARS_ENABLED`).
|
||||
- A referral program in sats: random invite codes, a reward once an
|
||||
invited user's first Lightning purchase settles, and a daily cap. Next
|
||||
to it, Telegram's own affiliate program for Stars spent in the Mini App
|
||||
([docs/AFFILIATE.md](docs/AFFILIATE.md)).
|
||||
- Inline mode (`INLINE_MODE_ENABLED`): `@bot <link>` in any chat sends a
|
||||
cached file when the user's limits allow it, or opens the bot for it.
|
||||
- Money is safe: append-only ledger, idempotent settlement, reconciliation
|
||||
at startup, automatic refunds for failed downloads.
|
||||
- Gift codes, referral rewards and tips.
|
||||
- Gift codes and tips.
|
||||
- A smart cache: repeat downloads are instant, two people asking for the
|
||||
same video share one download, lower qualities are made from a stored
|
||||
copy. A cache hit is checked against exactly the same limits as a fresh
|
||||
@@ -95,15 +115,16 @@ curl localhost:8080/healthz
|
||||
|
||||
| Command | What it does |
|
||||
| --- | --- |
|
||||
| `/start` | Welcome message |
|
||||
| `/help` | Usage and your limits |
|
||||
| `/start` | Welcome message, with a language picker the first time |
|
||||
| `/help` | A short introduction and your limits, with sections for commands, account and groups |
|
||||
| `/settings` | Your settings in one place (private chat): format, audio only, ask every time, language, pass, balance, invites, "Add me to a group" |
|
||||
| `/dl <link>` | Download a video. In groups also works as a reply to a link. |
|
||||
| `/audio <link>` | Download the audio as MP3 |
|
||||
| `/thumb <link>` | Send the thumbnail |
|
||||
| `/subs <link>` | Pick a subtitle language and get the file |
|
||||
| `/info <link>` | Show formats and sizes without downloading |
|
||||
| `/fresh <link>` | Download again instead of using a saved copy |
|
||||
| `/history` | Your past downloads, one tap to get them again |
|
||||
| `/history` | Your past downloads, five per page: send again, the thumbnail, remove one or clear all |
|
||||
| `/queue` | Your downloads in progress |
|
||||
| `/cancel` | Cancel your downloads |
|
||||
| `/account` | Your pass, balance and usage today (private chat) |
|
||||
@@ -111,10 +132,9 @@ curl localhost:8080/healthz
|
||||
| `/buy` | Buy a pass or credits (private chat) |
|
||||
| `/credits` | Balance and top up (private chat) |
|
||||
| `/redeem <code>` | Use a gift code (private chat) |
|
||||
| `/referral` | Your invite link and how many joined (private chat) |
|
||||
| `/referral` | Your invite link, what it earned, share, copy and QR buttons (private chat) |
|
||||
| `/donate` | Send a tip (private chat) |
|
||||
|
||||
| `/quality` | Your default format, to skip the card |
|
||||
| `/quality` | Your default format: ask every time, best that fits your limit, a quality, or audio only |
|
||||
| `/language` | Change the bot's language |
|
||||
| `/privacy`, `/terms`, `/support` | Short texts (private chat) |
|
||||
|
||||
@@ -139,10 +159,10 @@ Owner commands (private chat, only for the IDs in `OWNER_IDS`):
|
||||
| `/workers` | Workers, their state, load, tags and yt-dlp version |
|
||||
| `/drain <worker>` | Let a worker finish its jobs and take no new ones |
|
||||
| `/ytdlp update` | Update yt-dlp on every worker now |
|
||||
| `/stats`, `/queue all` | Numbers, and every active job |
|
||||
| `/stats`, `/queue all` | Numbers (revenue by payment method included), and every active job |
|
||||
| `/user <id>`, `/group <id>` | Look up a user or a group |
|
||||
| `/ban <id>`, `/unban <id>` | Ban a user |
|
||||
| `/grant`, `/credit`, `/refund` | Passes, credits and gift codes |
|
||||
| `/grant`, `/credit`, `/refund` | Passes, credits and gift codes. `/refund <purchase ID>` returns a Stars payment. |
|
||||
| `/blocklist` | Block sites or single videos |
|
||||
| `/broadcast <text>` | Message every user, after a confirmation |
|
||||
| `/maint on\|off` | Maintenance mode |
|
||||
@@ -219,6 +239,9 @@ change it. A test fails when `dist` is older than its sources.
|
||||
- [docs/WORKERS.md](docs/WORKERS.md): adding download workers, tags, drain.
|
||||
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md): how the pieces fit.
|
||||
- [docs/TRANSLATING.md](docs/TRANSLATING.md): editing a catalog, adding a language.
|
||||
- [docs/AFFILIATE.md](docs/AFFILIATE.md): opening Telegram's affiliate program for the bot.
|
||||
- [docs/SCREENS.md](docs/SCREENS.md): every screen of the bot in English, Spanish and Dutch, generated by a test.
|
||||
- [docs/UPDATE_NOTES.md](docs/UPDATE_NOTES.md): what the latest round of changes found and changed.
|
||||
- [docs/ASSUMPTIONS.md](docs/ASSUMPTIONS.md): decisions and verified facts.
|
||||
|
||||
## Layout
|
||||
|
||||
Reference in New Issue
Block a user