Skip to content

Fall back to document.thumb for videos sent as a Telegram document#407

Merged
techeng322 merged 1 commit into
mainfrom
techengme/myc-5017-videos-sent-to-telegram-bot-as-a-document-dont-get-a-preview
Jul 12, 2026
Merged

Fall back to document.thumb for videos sent as a Telegram document#407
techeng322 merged 1 commit into
mainfrom
techengme/myc-5017-videos-sent-to-telegram-bot-as-a-document-dont-get-a-preview

Conversation

@techeng322

Copy link
Copy Markdown
Collaborator

Summary

  • extractTelegramFileIds only read raw.video?.thumb?.file_id; a video sent as a Telegram "document" (to skip compression) carries its file under message.document instead, and the client-generated thumbnail lands in document.thumb — never checked
  • Result: thumbFileId was always undefined for document-uploaded videos, so uploadVideoAttachment.ts never fetched a thumb and the minted token metadata had no image field (no preview)
  • Fix: fall back to raw.document?.thumb?.file_id when raw.video?.thumb?.file_id is absent; video.thumb still takes priority when both are present

Stacked on #406 (base branch is that PR's branch, not main) since this branch was cut from its tip — diff here is just the 2 files for this fix.

Test plan

  • pnpm vitest run src/lib/telegram/chat/attachment/__tests__/extractTelegramFileIds.test.ts — 10 tests passing, including new cases for document.thumb fallback and video.thumb precedence
  • pnpm vitest run src/lib/telegram/chat — 251 tests passing
  • Manual: send a video to the Telegram bot as a document (file attach, not compressed video) and confirm the minted token has a preview image

🤖 Generated with Claude Code

extractTelegramFileIds only read raw.video?.thumb, so videos sent as
a Telegram "document" (to skip compression) never got a thumbnail —
Telegram puts those under message.document, whose thumb was never
checked. Minted tokens for document-uploaded videos ended up with no
preview image as a result.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
in-process-api Ready Ready Preview Jul 12, 2026 2:57am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d1e8cb3f-e7b1-4108-a188-bc6bd147f8b4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch techengme/myc-5017-videos-sent-to-telegram-bot-as-a-document-dont-get-a-preview

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@techeng322 techeng322 changed the base branch from techengme/myc-5016-telegram-video-uploads-didnt-set-salestart-from-capture-time to main July 12, 2026 02:57
@techeng322 techeng322 merged commit 2590470 into main Jul 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant