Skip to content

feat(message): link preview options (InvertMedia, WebPage builder)#1744

Merged
ernado merged 1 commit into
mainfrom
fix/1510-link-preview
Jun 10, 2026
Merged

feat(message): link preview options (InvertMedia, WebPage builder)#1744
ernado merged 1 commit into
mainfrom
fix/1510-link-preview

Conversation

@ernado

@ernado ernado commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

Adds high-level support for link preview options, so callers no longer need raw tg structs.

  • Builder.InvertMedia() — moves the media / link preview above the message text (invert_media), threaded into sendMessage, sendMedia and sendMultiMedia.
  • WebPage(url, caption...) media builder wrapping inputMediaWebPage, with ForceLargeMedia, ForceSmallMedia and Optional options.

Combined with the existing NoWebpage() (disable preview), this covers the Bot API LinkPreviewOptions set referenced in the issue.

The shared protectedSendRequest interface is intentionally left untouched, since forward reuses it and messages.forwardMessages has no invert_media.

Test

  • TestBuilder_InvertMedia — asserts invert_media on the outgoing sendMessage.
  • TestWebPage — asserts the inputMediaWebPage payload, including forced-large/optional options.

Fixes #1510

🤖 Generated with Claude Code

Adds Builder.InvertMedia() to move the media/link preview above the
message text (invert_media), and a WebPage media builder wrapping
inputMediaWebPage with ForceLargeMedia/ForceSmallMedia/Optional, so link
preview options can be set without raw tg structs. Combined with the
existing NoWebpage(), this covers Bot API LinkPreviewOptions.

Fixes #1510

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.59%. Comparing base (a8c40d9) to head (2ebc019).

Files with missing lines Patch % Lines
telegram/message/webpage.go 84.21% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1744   +/-   ##
=======================================
  Coverage   70.59%   70.59%           
=======================================
  Files         466      467    +1     
  Lines       20463    20488   +25     
=======================================
+ Hits        14445    14463   +18     
- Misses       4953     4957    +4     
- Partials     1065     1068    +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ernado ernado merged commit 868bacb into main Jun 10, 2026
14 checks passed
@ernado ernado deleted the fix/1510-link-preview branch June 10, 2026 22:34
ernado added a commit that referenced this pull request Jun 10, 2026
Records shipped PRs (#1743, #1744, #1745), the closed #824, two items
found already implemented (#214, #189), per-issue status, and a tiered
difficulty analysis of the remaining open items.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

Link Preview Options

1 participant