Skip to content

docs(examples): add runnable examples for helper packages#1773

Merged
ernado merged 2 commits into
mainfrom
examples/166-helper-examples
Jun 12, 2026
Merged

docs(examples): add runnable examples for helper packages#1773
ernado merged 2 commits into
mainfrom
examples/166-helper-examples

Conversation

@ernado

@ernado ernado commented Jun 12, 2026

Copy link
Copy Markdown
Member

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 + Terminal auth) and is listed in examples/README.md.

Helper-package examples

Binary Helpers demonstrated Connects?
get-participants peers.Manager resolve + query/channels/participants iterator (channels.getParticipants) yes
bot-inline message/inline results builder + message/styling, via OnBotInlineQuery yes
takeout takeout session helper (account.initTakeoutSession) + wrapped API calls yes
deeplink deeplink.Parse / IsDeeplinkLike + type routing — offline CLI, no login no
dialogs query.GetDialogs + query.Messages(...).GetHistory iterators yes
rich-message message/rich page blocks + inline rich text → Builder.RichMessage yes
upload-url uploader/source HTTPSource + uploader.FromSource streaming upload yes

Examples requested in #166 comments

Binary Request(s) addressed
send-message "user login by code with session storage in file", "reconnect with the previous session", "send a message to a channel" (requested 3×)
save-media "reply to a picture/video with key phrase 'save' and it'll save the referred media"
get-participants "Please add example of ChannelsGetParticipants method usage"

Comment requests intentionally not added

  • Add contact by phone number — the thread itself advises against it (account-ban risk); left out deliberately.
  • Get a peer's phone number inside OnNewMessage — phone numbers are generally not exposed by the API due to privacy, so there's no meaningful example.

Notes

  • examples/go.mod / go.sum gain one entry: the rich package transitively pulls in github.com/yuin/goldmark, added via go mod tidy in the examples module.
  • All examples build, go vet clean, gofmt clean.
  • Existing helpers already covered by current binaries (uploaderbot-upload, downloadergif-download, etc.) were not duplicated.

🤖 Generated with Claude Code

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

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.06%. Comparing base (5bd59ff) to head (ba538b4).
⚠️ Report is 1 commits behind head on main.

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.
📢 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.

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>
@ernado ernado merged commit 15e3439 into main Jun 12, 2026
14 checks passed
@ernado ernado deleted the examples/166-helper-examples branch June 12, 2026 20:34
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