Files
Media-download-telegram-bot/docs/UPDATE_NOTES.md
T
MichilisandClaude Opus 5.5 6843053582 Phase 1: quick flow fixes
- One message per job: the status message is deleted once the file is
  sent, or shortened to "Sent." when Telegram keeps it.
- No reply quotes in private chats; groups keep them.
- Queue status only mentions the position when the wait is above
  QUEUE_NOTICE_THRESHOLD_SECONDS or somebody is ahead. Status edits are
  throttled to one per 2.5 s per message; a state that arrives too soon
  is shown later instead of dropped. The wait estimate is 0 with a free
  slot.
- Caption with title (uploader and date when generic), uploader,
  duration, a short source link without tracking parameters and an
  optional "via @bot" line (CAPTION_ATTRIBUTION). Uploaded videos get a
  320 px JPEG thumbnail; merged MP4s are written with faststart.
- Buttons under the result: Audio (MP3), Other quality, Thumbnail,
  Delete. Requester only in groups.
- Language resolved once per update and passed in the context. A
  fallback to English is logged as a bug; a test walks every screen in
  Spanish and Dutch. Language picker on the first /start.
- Sizes without a zero decimal ("50 MB").
- First link of a new user shows the card once and sets the default to
  "best that fits my limit".
- Errors offer the next step (Try again, Smaller quality, Upgrade, Open
  app); passing lookup failures are retried once.
- Up to MULTI_LINK_MAX links per message; a link sent a moment ago gets
  "already sent" with a Send again button.
- Mini App menu button, labelled per private chat in the user's
  language.
- Personal /settings in private chats with an "Add me to a group"
  button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 20:08:58 +00:00

4.2 KiB

Update notes: flows, Stars, affiliate program

What I found in the repository before changing it, and what this round of work changes. Decisions made on the way are recorded in ASSUMPTIONS.md under "Update round".

What is there

  • Shape. cmd/core (Telegram, DB, queue, HTTP) and cmd/worker (yt-dlp, ffmpeg). The core embeds a worker by default. See ARCHITECTURE.md.
  • Bot front end (internal/bot). bot.go routes updates and holds the send and edit helpers. commands.go dispatches commands, card.go runs the link flow (placeholder, probe, card, start), status.go keeps the status message current with a throttle, deliver.go sends files, money.go covers buying, offers and fulfilment, groups.go covers group admin commands and personal preferences, extras.go covers playlists, subtitles and history, live.go the HTML widgets, appops.go the Mini App operations.
  • Language. actorFor already resolves the language once per update: the stored choice, then Telegram's language_code, then English. A group's own language wins in that group. Handlers take the result as act.lang. Catalogs are locales/{en,es,nl}.toml. The catalog tests already check for missing keys, placeholders and unused messages.
  • Errors. yt-dlp output is classified in internal/ytdlp/classify.go into codes with an error.<code> message each. A retryable job failure is retried once by the scheduler. Lookups are not retried.
  • Entitlement (internal/entitle) is a pure resolver. service.Start and service.Preview are the single gate for all paths: chat, Mini App, cache hits and resends.
  • Billing (internal/billing) is Lightning only (LNbits), with a wallet and ledger per user or group, passes, credits, one-off payments, gift codes and Cashu.
  • Referrals store the inviter's Telegram ID from /start ref_<id>. Only the count is shown and nothing is rewarded yet, although the REFERRAL_REWARD setting exists.
  • Mini App (web/miniapp, React and Vite, built into dist/ and embedded). Pages: Home, Queue, History, Buy, Me (Profile.tsx), Groups. The API is in internal/api/miniapp.go.
  • Tests run the real core against a fake Bot API (internal/tg/fakeserver) and a scripted yt-dlp, on SQLite by default and on Postgres with DLBOT_TEST_DB=postgres.

Flow problems found

  • A finished download leaves two messages: the file, and the card edited to "Done. Enjoy." under it.
  • Every answer in a private chat quotes the user's message.
  • A job that starts at once still shows "In the queue. Position 1".
  • Phase changes skip the edit throttle, so a fast job can edit its status several times a second.
  • The caption is only the title. There is no source link, and no thumbnail is uploaded with videos. Merged MP4 files are not written with faststart.
  • /settings refuses in a private chat.
  • Sizes read "50.0 MB".
  • Errors are text only, with no next step.
  • At most 3 links per message. The same link sent twice is downloaded twice.
  • Referral links show the raw Telegram user ID.

What changes, by phase

  1. Quick flow fixes. One status message per job that is removed once the file is sent. No reply quotes in private chats. Quieter queue status and a strict 2.5 s edit throttle. A full caption with a cleaned source link, an optional via @bot line, and a thumbnail for uploaded videos. Buttons under the result. Personal /settings. Localized menu button. Error buttons and one automatic retry of lookups. Up to N links per message, with "Already sent" for repeats. First-run quality prompt. A strict language test.
  2. Command screens. Sectioned /help, a reworked /quality with "Best that fits my limit", and a paginated /history with richer rows.
  3. Own referral system. Short random codes, rewards paid only after a first settled Lightning purchase, and a daily cap.
  4. Telegram Stars. A second payment method next to Lightning: invoices in XTR, pre-checkout, successful payment, refunds, and a per-method price table.
  5. Telegram affiliate program. Owner docs, Mini App Stars invoices, tolerant /start payload handling, and an Earn section.
  6. Inline mode and polish (optional).