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:
Michilis
2026-11-18 21:47:26 +00:00
co-authored by Claude Opus 5.5
parent d64db03f21
commit 44d0905fa3
18 changed files with 591 additions and 27 deletions
+55 -1
View File
@@ -176,6 +176,59 @@ opened again.
If step 3 is skipped, the button in private chats still works. Only the
`?startapp` links from groups and the profile button need it.
With the app on, the bot also sets the **menu button** next to the message
field to open the app. The default label is in the source language; each
private chat gets the label in its user's language the first time they
write, and again when they switch language. The command list stays one
tap away under "/".
## Telegram Stars
Stars are a second way to pay for passes and credit packs, next to
Lightning. They need nothing in @BotFather.
```sh
STARS_ENABLED=true
STARS_PRICES=pass_day=50,pass_week=200,pass_month=600,credits_1000=70,credits_5000=330,credits_20000=1300
```
Prices in Stars are set on their own and are never converted from sats.
A product without a price is not sold for Stars. Lightning stays the first
option on every screen; "Pay with Stars" switches to the Stars prices.
Stars purchases are confirmed by Telegram's `successful_payment` update,
never by polling, and each Telegram charge settles once.
To refund a Stars payment, send `/refund <purchase ID>` (or the Telegram
charge ID from the log). Telegram returns the Stars, and the credits or the
pass are taken back. `/stats` shows revenue per payment method.
Stars and Telegram's affiliate program: see [AFFILIATE.md](AFFILIATE.md).
## Inline mode
`@bot <link>` in any chat. When the file is in the cache and the user's
limits allow it without paying, it is sent as is; otherwise the result
opens the bot, which downloads it the usual way.
1. In @BotFather: `/setinline`, pick the bot, enter a placeholder such as
"Paste a link".
2. In @BotFather: `/setinlinefeedback`, pick the bot, **100%**. Telegram
then reports which result was sent, and an inline send counts as a
download of the day. Without it, inline sends are still only offered
within the limits, but they do not count against the daily quota.
3. Set `INLINE_MODE_ENABLED=true` and restart.
## Referrals and flow settings
| Setting | Default | What it does |
| --- | --- | --- |
| `QUEUE_NOTICE_THRESHOLD_SECONDS` | 10 | Show the queue position only above this wait, or with somebody ahead |
| `MULTI_LINK_MAX` | 5 | Links of one message that are handled |
| `CAPTION_ATTRIBUTION` | true | A "via @bot" line under file captions |
| `REFERRAL_REWARD_SATS` | 200 | Sats an inviter earns when an invited user's first Lightning purchase settles (old name `REFERRAL_REWARD` still works) |
| `REFERRAL_DAILY_CAP` | 2000 | Most an inviter earns per day; more waits for the next day. 0 means no cap. |
| `AFFILIATE_ENABLED` | false | Explain Telegram's affiliate program in the Mini App |
## Languages, menus and the bot's profile
At every start the core publishes its command menus in every language it
@@ -230,7 +283,7 @@ Only in a private chat, only for the user IDs in `OWNER_IDS`.
| `/cache` | Cache size, hit rate, volume saved |
| `/purge <link>` | Take a video down: delete its files and block it for good |
| `/blocklist add site <host>` | Refuse a whole site. Also `add key <extractor:id>`, `remove`, and no argument to list. |
| `/stats` | Users, jobs, queue, cache, payments, and whether the ledger and balances agree |
| `/stats` | Users, jobs, queue, cache, payments, revenue per payment method, and whether the ledger and balances agree |
| `/queue all` | Every queued and running job with its worker and tags |
| `/user <id>`, `/group <chat id>` | Look one up |
| `/ban <id>`, `/unban <id>` | A banned user gets no answers |
@@ -238,6 +291,7 @@ Only in a private chat, only for the user IDs in `OWNER_IDS`.
| `/grant code credits <sats> [uses]` | Create a gift code. Also `code day\|week\|month`. |
| `/credit <id> <sats>` | Add credits |
| `/refund <id> <sats>`, `/refund <id> pass <duration>` | Give sats back, or extend a pass |
| `/refund <purchase or charge ID>` | Return a Stars payment and take back what it granted |
| `/broadcast <text>` | Preview, then send to everyone on confirmation |
| `/maint on\|off` | Refuse new downloads for everyone but owners |
| `/reload i18n` | Reload translations from `LOCALES_DIR` |