docs(examples): add runnable examples for helper packages#1773
Merged
Conversation
Add example binaries under examples/ covering helpers that previously had no runnable example, addressing #166: - get-participants: peers.Manager resolve + query/channels/participants iterator (channels.getParticipants, requested in #166) - bot-inline: message/inline results builder + message/styling - takeout: takeout session helper + wrapped API calls - deeplink: deeplink.Parse / IsDeeplinkLike (offline CLI) - dialogs: query.GetDialogs + query.Messages(...).GetHistory iterators - rich-message: message/rich page blocks + Builder.RichMessage - upload-url: uploader/source HTTPSource + uploader.FromSource The rich package pulls in goldmark transitively, so it is added to the examples module go.sum. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1773 +/- ##
==========================================
- Coverage 71.10% 71.06% -0.05%
==========================================
Files 501 501
Lines 23501 23502 +1
==========================================
- Hits 16711 16702 -9
- Misses 5569 5574 +5
- Partials 1221 1226 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Address remaining example requests from the #166 comment thread: - send-message: user login by code with session.FileStorage, reconnect using the stored session, and send a message to a channel/user (covers the three most-requested scenarios in #166) - save-media: userbot that downloads the media of a message you reply to with "save", reusing query/messages Elem.File and the downloader Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Part of #166. Adds runnable example binaries under
examples/for helper packages and for the concrete scenarios requested in the issue's comment thread. Each follows the existing example style (examples.Run/ClientFromEnvironment+Terminalauth) and is listed inexamples/README.md.Helper-package examples
get-participantspeers.Managerresolve +query/channels/participantsiterator (channels.getParticipants)bot-inlinemessage/inlineresults builder +message/styling, viaOnBotInlineQuerytakeouttakeoutsession helper (account.initTakeoutSession) + wrapped API callsdeeplinkdeeplink.Parse/IsDeeplinkLike+ type routing — offline CLI, no logindialogsquery.GetDialogs+query.Messages(...).GetHistoryiteratorsrich-messagemessage/richpage blocks + inline rich text →Builder.RichMessageupload-urluploader/sourceHTTPSource +uploader.FromSourcestreaming uploadExamples requested in #166 comments
send-messagesave-mediaget-participantsChannelsGetParticipantsmethod usage"Comment requests intentionally not added
OnNewMessage— phone numbers are generally not exposed by the API due to privacy, so there's no meaningful example.Notes
examples/go.mod/go.sumgain one entry: therichpackage transitively pulls ingithub.com/yuin/goldmark, added viago mod tidyin the examples module.go vetclean,gofmtclean.uploader→bot-upload,downloader→gif-download, etc.) were not duplicated.🤖 Generated with Claude Code