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
@@ -43,6 +43,7 @@ phase; sections for later phases say so.
|
||||
| `internal/billing/lnbits` | LNbits HTTP client. |
|
||||
| `internal/cache` | file_id and stored-copy cache, TTLs, eviction, takedown. |
|
||||
| `internal/ffmpeg` | Transcoding lower profiles from a stored copy. |
|
||||
| `internal/thumb` | The small JPEG thumbnail uploaded with a video, made from the source's thumbnail image, with no access to private addresses. |
|
||||
| `internal/groups` | Group admin verification with a cache, host list matching. |
|
||||
| `internal/links` | URL extraction, validation, redaction. |
|
||||
| `internal/storage` | `Storage` interface and the local disk backend. |
|
||||
|
||||
@@ -1170,3 +1170,32 @@ the affiliate program. What was found and planned is in
|
||||
- **Checked in a browser.** The Mini App browser test (headless Chromium
|
||||
against a core in test mode) checks the Earn section in English,
|
||||
Spanish and Dutch, and the new referral link format.
|
||||
|
||||
### Phase 6: inline mode and polish
|
||||
|
||||
- **Inline mode is off by default** (`INLINE_MODE_ENABLED`). It also
|
||||
needs `/setinline` in @BotFather.
|
||||
- **The cached file.** An inline query with a link looks it up, using
|
||||
the remembered metadata when there is some, for at most 5 seconds. The
|
||||
file is picked with the user's default format; "ask every time" counts
|
||||
as Best. It is offered by `file_id` only when:
|
||||
- the cache has the file,
|
||||
- the same admission check as every other path passes on the cached
|
||||
file's real size and length, and
|
||||
- nothing has to be paid. A download paid with credits needs the bot
|
||||
chat, so it gets the deep link.
|
||||
- **Everything else** gets one article result. Choosing it posts the
|
||||
cleaned link with a button that opens the bot, and the button above the
|
||||
results opens the bot too. Both carry `/start il_<token>`, where the
|
||||
token names the link in the `kv` table, because a link does not fit in
|
||||
the 64 character start parameter. The bot then runs the usual flow.
|
||||
- **Counting.** An inline send counts as a download of the day when
|
||||
Telegram reports it chosen (`chosen_inline_result`), which needs inline
|
||||
feedback at 100% in @BotFather. Each offered result counts once.
|
||||
Without inline feedback, inline sends are only offered within the
|
||||
limits but do not use up the quota; OPERATIONS.md says so.
|
||||
- Answers are personal (`is_personal`) and cached by Telegram for 10
|
||||
seconds, since they depend on the user's limits.
|
||||
- **Docs.** README and OPERATIONS describe the new flows, Stars, inline
|
||||
mode and every new setting. `docs/SCREENS.md` is regenerated from the
|
||||
language test.
|
||||
|
||||
+55
-1
@@ -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` |
|
||||
|
||||
+19
-11
@@ -145,6 +145,14 @@ Downloading…
|
||||
|
||||
editMessageText
|
||||
|
||||
```
|
||||
<b>Test Video</b>
|
||||
Sending it to Telegram…
|
||||
[Cancel]
|
||||
```
|
||||
|
||||
editMessageText
|
||||
|
||||
```
|
||||
<b>Test Video</b>
|
||||
Sending it to Telegram…
|
||||
@@ -354,7 +362,7 @@ editMessageText
|
||||
|
||||
Share your link. When somebody you invited pays for a first purchase in sats (Lightning), you get 200 sats in credits.
|
||||
|
||||
https://t.me/nr_dl_test_bot?start=rf_YY6OJU6T
|
||||
https://t.me/nr_dl_test_bot?start=rf_QY6RIIO4
|
||||
|
||||
Invited: 0 · Bought something: 0
|
||||
Earned: 0 sats · Waiting: 0 sats
|
||||
@@ -567,7 +575,7 @@ sendMessage
|
||||
|
||||
Share your link. When somebody you invited pays for a first purchase in sats (Lightning), you get 200 sats in credits.
|
||||
|
||||
https://t.me/nr_dl_test_bot?start=rf_YY6OJU6T
|
||||
https://t.me/nr_dl_test_bot?start=rf_QY6RIIO4
|
||||
|
||||
Invited: 0 · Bought something: 0
|
||||
Earned: 0 sats · Waiting: 0 sats
|
||||
@@ -865,7 +873,7 @@ sendPhoto
|
||||
```
|
||||
<b>Day pass</b> · 700 sats
|
||||
|
||||
<code>lnbc7000n1fakee38a3d34236055a47c726ecb0a1c30d15a717a59fccef6acb0cff8dcb7dc200f</code>
|
||||
<code>lnbc7000n1fake1f8874acf5beade88ce311a2ad90ee98ca4d002223ea4dc5b52cf9633bb128f1</code>
|
||||
|
||||
Scan the code or tap the invoice to copy it. Valid for 10 minutes.
|
||||
[Open in wallet]
|
||||
@@ -1257,7 +1265,7 @@ editMessageText
|
||||
|
||||
Comparte tu enlace. Cuando alguien que invitaste pague una primera compra en sats (Lightning), recibes 200 sats en créditos.
|
||||
|
||||
https://t.me/nr_dl_test_bot?start=rf_Q3U2NIQH
|
||||
https://t.me/nr_dl_test_bot?start=rf_5NFHSMPX
|
||||
|
||||
Invitados: 0 · Compraron algo: 0
|
||||
Ganado: 0 sats · En espera: 0 sats
|
||||
@@ -1470,7 +1478,7 @@ sendMessage
|
||||
|
||||
Comparte tu enlace. Cuando alguien que invitaste pague una primera compra en sats (Lightning), recibes 200 sats en créditos.
|
||||
|
||||
https://t.me/nr_dl_test_bot?start=rf_Q3U2NIQH
|
||||
https://t.me/nr_dl_test_bot?start=rf_5NFHSMPX
|
||||
|
||||
Invitados: 0 · Compraron algo: 0
|
||||
Ganado: 0 sats · En espera: 0 sats
|
||||
@@ -1768,7 +1776,7 @@ sendPhoto
|
||||
```
|
||||
<b>Pase de un día</b> · 700 sats
|
||||
|
||||
<code>lnbc7000n1fake7bf3f553278730f9f02e2e8e66bb1524a1efc083ab3bfe31c83c00e15d64e033</code>
|
||||
<code>lnbc7000n1fake98f92f6fc418f27ce78a3b0d003099e8ed16dd676184d3f10c43d66624527b10</code>
|
||||
|
||||
Escanea el código o toca la factura para copiarla. Vale por 10 minutos.
|
||||
[Abrir en la billetera]
|
||||
@@ -1881,7 +1889,7 @@ editMessageText
|
||||
|
||||
```
|
||||
<b>Test Video</b>
|
||||
Naar Telegram sturen…
|
||||
Downloaden…
|
||||
[Annuleren]
|
||||
```
|
||||
|
||||
@@ -1889,7 +1897,7 @@ editMessageText
|
||||
|
||||
```
|
||||
<b>Test Video</b>
|
||||
Downloaden…
|
||||
Naar Telegram sturen…
|
||||
[Annuleren]
|
||||
```
|
||||
|
||||
@@ -2160,7 +2168,7 @@ editMessageText
|
||||
|
||||
Deel je link. Als iemand die je uitnodigde een eerste aankoop in sats (Lightning) betaalt, krijg jij 200 sats aan tegoed.
|
||||
|
||||
https://t.me/nr_dl_test_bot?start=rf_TXUCNI2E
|
||||
https://t.me/nr_dl_test_bot?start=rf_I4ADMUUF
|
||||
|
||||
Uitgenodigd: 0 · Iets gekocht: 0
|
||||
Verdiend: 0 sats · Wacht nog: 0 sats
|
||||
@@ -2373,7 +2381,7 @@ sendMessage
|
||||
|
||||
Deel je link. Als iemand die je uitnodigde een eerste aankoop in sats (Lightning) betaalt, krijg jij 200 sats aan tegoed.
|
||||
|
||||
https://t.me/nr_dl_test_bot?start=rf_TXUCNI2E
|
||||
https://t.me/nr_dl_test_bot?start=rf_I4ADMUUF
|
||||
|
||||
Uitgenodigd: 0 · Iets gekocht: 0
|
||||
Verdiend: 0 sats · Wacht nog: 0 sats
|
||||
@@ -2671,7 +2679,7 @@ sendPhoto
|
||||
```
|
||||
<b>Dagpas</b> · 700 sats
|
||||
|
||||
<code>lnbc7000n1fake5443af8ff471a30e71eaa1ee0db07d5d314f447f88f895369ea8892d717b5879</code>
|
||||
<code>lnbc7000n1fakebd6d73f6fb17f69e4afb76c52ffb1d278cc127bc403371b1bafbcd7b580e457b</code>
|
||||
|
||||
Scan de code of tik op de factuur om hem te kopiëren. Geldig voor 10 minuten.
|
||||
[Openen in wallet]
|
||||
|
||||
Reference in New Issue
Block a user