feat(message): link preview options (InvertMedia, WebPage builder)#1744
Merged
Conversation
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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds high-level support for link preview options, so callers no longer need raw
tgstructs.Builder.InvertMedia()— moves the media / link preview above the message text (invert_media), threaded intosendMessage,sendMediaandsendMultiMedia.WebPage(url, caption...)media builder wrappinginputMediaWebPage, withForceLargeMedia,ForceSmallMediaandOptionaloptions.Combined with the existing
NoWebpage()(disable preview), this covers the Bot APILinkPreviewOptionsset referenced in the issue.The shared
protectedSendRequestinterface is intentionally left untouched, sinceforwardreuses it andmessages.forwardMessageshas noinvert_media.Test
TestBuilder_InvertMedia— assertsinvert_mediaon the outgoingsendMessage.TestWebPage— asserts theinputMediaWebPagepayload, including forced-large/optional options.Fixes #1510
🤖 Generated with Claude Code