Skip to content

feat(examples): add bot-bigbuckbunny video reply example#1778

Merged
ernado merged 1 commit into
mainfrom
feat/example-bot-bigbuckbunny
Jun 15, 2026
Merged

feat(examples): add bot-bigbuckbunny video reply example#1778
ernado merged 1 commit into
mainfrom
feat/example-bot-bigbuckbunny

Conversation

@ernado

@ernado ernado commented Jun 15, 2026

Copy link
Copy Markdown
Member

Summary

Adds a new examples/bot-bigbuckbunny example: a bot that replies to any incoming message with a video (Big Buck Bunny by default, overridable via -url).

It demonstrates:

  • Multi-connection upload poolclient.Pool(N) fed to the uploader, with uploader.WithThreads(N) so part uploads fan out across the sub-connections. -pool=false falls back to the main connection for comparison.
  • Progress logging — a custom uploader.Progress that logs at INFO throttled to every 5s, including instantaneous and average upload speed.
  • TTY-aware colored summary to stdout after each upload (size, MIME, resolution, upload time, avg speed, transport, thumbnail).
  • Local caching — the video is downloaded to the OS temp dir once (atomic rename on success) and reused.

Optional ffmpeg integration (via github.com/ernado/ff)

Best-effort; skipped with a warning when ffmpeg/ffprobe are not in PATH:

  • Probes width/height/duration (set with Resolution/Duration).
  • Derives the MIME type from the container format.
  • Generates and attaches a JPEG thumbnail.
  • -cut <dur> trims the video (ffmpeg -t; lossless stream copy when not also compressing).
  • -max-size <MB> re-encodes to approximately fit a size budget (target bitrate derived from size and the possibly-cut duration; skipped when the source already fits).

Notes

  • New external deps (ernado/ff + transitive OTel/sdk) land only in the examples module's go.mod/go.sum, not the core td module.
  • -max-size is single-pass -b:v targeting, so output size is approximate.

Test plan

  • go build ./bot-bigbuckbunny/, go vet, and gofmt -l all clean.
  • Manual: set BOT_TOKEN/APP_ID/APP_HASH, run, message the bot; verify video reply, progress logs, and summary.

🤖 Generated with Claude Code

Bot that replies to any message with a video (Big Buck Bunny by default,
overridable via -url). Demonstrates a multi-connection upload pool fed to
the uploader, throttled INFO progress logging with upload speed, and a
TTY-aware colored summary.

Optional ffmpeg integration via github.com/ernado/ff: probes
dimensions/duration, derives MIME from the container format, generates a
thumbnail, and can cut (-cut) and/or size-compress (-max-size) the video
before upload. All ffmpeg steps are best-effort and skipped with a warning
when ffmpeg/ffprobe are unavailable.

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

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.24%. Comparing base (5e4cd68) to head (68ae386).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1778   +/-   ##
=======================================
  Coverage   71.24%   71.24%           
=======================================
  Files         503      503           
  Lines       23593    23593           
=======================================
  Hits        16809    16809           
  Misses       5551     5551           
  Partials     1233     1233           

☔ 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 38b2b54 into main Jun 15, 2026
14 checks passed
@ernado ernado deleted the feat/example-bot-bigbuckbunny branch June 15, 2026 00:08
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