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>
This commit is contained in:
Michilis
2026-11-18 20:08:58 +00:00
co-authored by Claude Opus 5.5
parent 3c153af97f
commit 6843053582
52 changed files with 3369 additions and 271 deletions
+19
View File
@@ -94,6 +94,15 @@ type Config struct {
// Owners are the Telegram user IDs allowed to use owner commands.
Owners []int64 `toml:"owners" env:"OWNER_IDS"`
// QueueNoticeThresholdSeconds is the expected wait above which a queued
// download shows its position and wait. Shorter waits at the front of
// the queue show a plain "Downloading" state.
QueueNoticeThresholdSeconds int `toml:"queue_notice_threshold_seconds" env:"QUEUE_NOTICE_THRESHOLD_SECONDS"`
// MultiLinkMax is how many links of one message are handled.
MultiLinkMax int `toml:"multi_link_max" env:"MULTI_LINK_MAX"`
// CaptionAttribution adds a "via @botname" line to file captions.
CaptionAttribution bool `toml:"caption_attribution" env:"CAPTION_ATTRIBUTION"`
}
// Telegram holds the Bot API settings.
@@ -362,6 +371,10 @@ func Default() Config {
},
Rate: Rate{UserPerMinute: 10, GroupPerMinute: 30},
Log: Log{Level: "info", Format: "json"},
QueueNoticeThresholdSeconds: 10,
MultiLinkMax: 5,
CaptionAttribution: true,
}
}
@@ -436,6 +449,12 @@ func (c Config) Validate() error {
default:
errs = append(errs, "STORAGE_BACKEND must be local or s3")
}
if c.QueueNoticeThresholdSeconds < 0 {
errs = append(errs, "QUEUE_NOTICE_THRESHOLD_SECONDS must not be negative")
}
if c.MultiLinkMax < 1 || c.MultiLinkMax > 20 {
errs = append(errs, "MULTI_LINK_MAX must be between 1 and 20")
}
if c.Worker.Concurrency < 1 {
errs = append(errs, "WORKER_CONCURRENCY must be at least 1")
}