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:
co-authored by
Claude Opus 5.5
parent
3c153af97f
commit
6843053582
+11
-10
@@ -281,7 +281,7 @@ func TestCreditsTopUpAndPayPerDownload(t *testing.T) {
|
||||
card := h.card(alice, alice, bigLink)
|
||||
seq = h.press(alice, alice, card, "dl:")
|
||||
h.wait(seq, "sendVideo", nil)
|
||||
h.wait(seq, edits, textHas("Done"))
|
||||
h.finished(seq, 0)
|
||||
if got := h.balance(alice); got != 950 {
|
||||
t.Fatalf("balance = %d, want 950 after one 50 sat download", got)
|
||||
}
|
||||
@@ -383,7 +383,7 @@ func TestOverLimitPayForThisFileOnly(t *testing.T) {
|
||||
card := h.card(alice, alice, bigLink)
|
||||
seq := h.press(alice, alice, card, "dl:")
|
||||
offer := h.wait(seq, "sendMessage", textHas("You can lift the limit"))
|
||||
if !strings.Contains(offer.Text(), "larger than your limit of 50.0 MB") {
|
||||
if !strings.Contains(offer.Text(), "larger than your limit of 50 MB") {
|
||||
t.Fatalf("offer text = %q", offer.Text())
|
||||
}
|
||||
// 80 MB is one started 100 MB step: 100 base + 50.
|
||||
@@ -410,10 +410,11 @@ func TestOverLimitPayForThisFileOnly(t *testing.T) {
|
||||
if video.Files["video"].Size != 4096 {
|
||||
t.Fatalf("video = %+v", video.Files)
|
||||
}
|
||||
// The original card became the status message.
|
||||
done := h.wait(seq, edits, textHas("Done"))
|
||||
if done.MessageID != card.MessageID {
|
||||
t.Fatalf("status went to message %d, want the card %d", done.MessageID, card.MessageID)
|
||||
// The original card became the status message, and made way for the
|
||||
// file.
|
||||
file := h.finished(seq, 0)
|
||||
if gone := h.wait(file.Seq, "deleteMessage", nil); gone.MessageID != card.MessageID {
|
||||
t.Fatalf("deleted message %d, want the card %d", gone.MessageID, card.MessageID)
|
||||
}
|
||||
sent := h.waitSent(alice, 1)
|
||||
if sent[0].Source != "one_off" || sent[0].ChargeSats != 150 {
|
||||
@@ -689,7 +690,7 @@ func TestDailyQuota(t *testing.T) {
|
||||
for i := 0; i < 2; i++ {
|
||||
card := h.card(alice, alice, fmt.Sprintf("https://example.com/ok%d", i))
|
||||
seq := h.press(alice, alice, card, "dl:")
|
||||
h.wait(seq, edits, textHas("Done"))
|
||||
h.finished(seq, 0)
|
||||
}
|
||||
card = h.card(alice, alice, "https://example.com/third")
|
||||
seq = h.press(alice, alice, card, "dl:")
|
||||
@@ -704,7 +705,7 @@ func TestDailyQuota(t *testing.T) {
|
||||
// Another user has their own quota.
|
||||
card = h.card(bob, bob, "https://example.com/bob")
|
||||
seq = h.press(bob, bob, card, "dl:")
|
||||
h.wait(seq, edits, textHas("Done"))
|
||||
h.finished(seq, 0)
|
||||
}
|
||||
|
||||
func TestDailyVolumeCapAppliesToPaidUsers(t *testing.T) {
|
||||
@@ -714,12 +715,12 @@ func TestDailyVolumeCapAppliesToPaidUsers(t *testing.T) {
|
||||
}
|
||||
card := h.card(alice, alice, link)
|
||||
seq := h.press(alice, alice, card, "dl:")
|
||||
h.wait(seq, edits, textHas("Done")) // 3 MB delivered, cap is 2 MB
|
||||
h.finished(seq, 0) // 3 MB delivered, cap is 2 MB
|
||||
|
||||
card = h.card(alice, alice, "https://example.com/more")
|
||||
seq = h.press(alice, alice, card, "dl:")
|
||||
alert := h.wait(seq, "answerCallbackQuery", nil)
|
||||
if !strings.Contains(alert.Params["text"], "daily volume of 2.0 MB") {
|
||||
if !strings.Contains(alert.Params["text"], "daily volume of 2 MB") {
|
||||
t.Fatalf("alert = %q", alert.Params["text"])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user