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
@@ -103,11 +103,9 @@ func TestJobWidgetEndsWithTheFile(t *testing.T) {
|
||||
card := h.card(alice, alice, link)
|
||||
seq := h.press(alice, alice, card, "dl:")
|
||||
sent := h.wait(seq, "sendWidget", nil)
|
||||
h.wait(seq, "sendVideo", func(c fakeserver.Call) bool { return c.ChatID() == alice && !c.Failed })
|
||||
h.wait(seq, "editMessageWidgetData", isWidgetEdit(sent.MessageID, func(s widget.Job) bool {
|
||||
return s.Kind == "end" && s.Message == "Done. Enjoy."
|
||||
}))
|
||||
// The file replies to the link, like without widgets.
|
||||
file := h.wait(seq, "sendVideo", func(c fakeserver.Call) bool { return c.ChatID() == alice && !c.Failed })
|
||||
// Once the file is there, the widget goes like any status message.
|
||||
h.wait(file.Seq, "deleteMessage", func(c fakeserver.Call) bool { return c.MessageID == sent.MessageID })
|
||||
h.waitJobs(db.JobDone, 1)
|
||||
if n := len(h.srv.Calls("sendWidget")); n != 1 {
|
||||
t.Fatalf("%d widgets for one download", n)
|
||||
@@ -129,15 +127,18 @@ func TestJobCardFallsBackWhenSendWidgetFails(t *testing.T) {
|
||||
t.Fatal("the scripted failure did not happen")
|
||||
}
|
||||
// The ordinary card carries on as if widgets did not exist.
|
||||
h.wait(seq, "sendVideo", func(c fakeserver.Call) bool { return c.ChatID() == alice })
|
||||
done := h.wait(seq, "editMessageCaption", textHas("Done"))
|
||||
if done.MessageID != card.MessageID {
|
||||
t.Fatalf("the status went to message %d, the card is %d", done.MessageID, card.MessageID)
|
||||
h.wait(seq, "editMessageCaption", func(c fakeserver.Call) bool { return c.MessageID == card.MessageID })
|
||||
file := h.finished(seq, alice)
|
||||
if gone := h.wait(file.Seq, "deleteMessage", nil); gone.MessageID != card.MessageID {
|
||||
t.Fatalf("deleted message %d, the card is %d", gone.MessageID, card.MessageID)
|
||||
}
|
||||
if n := len(h.srv.Calls("sendWidget")); n != 1 {
|
||||
t.Fatalf("sendWidget was tried %d times for one download", n)
|
||||
}
|
||||
h.never(seq, "deleteMessage", func(c fakeserver.Call) bool { return c.Params["message_id"] == itoaInt(card.MessageID) })
|
||||
// The card is the status until the file is there.
|
||||
h.never(seq, "deleteMessage", func(c fakeserver.Call) bool {
|
||||
return c.Params["message_id"] == itoaInt(card.MessageID) && c.Seq < file.Seq
|
||||
})
|
||||
if body := scrapeMetrics(t, h); !strings.Contains(body, `dlbot_widgets_total{outcome="fallback",widget="status"} 1`) {
|
||||
t.Fatal("the fallback was not counted")
|
||||
}
|
||||
@@ -156,10 +157,10 @@ func TestWidgetsPauseWhenTheServerHasNone(t *testing.T) {
|
||||
h.srv.FailNext("sendWidget", 404, "Not Found: method not found")
|
||||
card := h.card(alice, alice, link)
|
||||
seq := h.press(alice, alice, card, "dl:")
|
||||
h.wait(seq, "editMessageCaption", textHas("Done"))
|
||||
h.finished(seq, alice)
|
||||
card = h.card(alice, alice, "https://example.com/second")
|
||||
seq = h.press(alice, alice, card, "dl:")
|
||||
h.wait(seq, "editMessageCaption", textHas("Done"))
|
||||
h.finished(seq, alice)
|
||||
if n := len(h.srv.Calls("sendWidget")); n != 1 {
|
||||
t.Fatalf("sendWidget tried %d times after the server said it has no such method", n)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user