Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(examples): enrich userbot example #1053

Merged
merged 1 commit into from
Apr 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ You can do it manually, see `bot-auth-manual` for example.

Please don't share `APP_ID` or `APP_HASH`, it can't be easily rotated.

| Name | Description | Features |
|--------------------------------------------|------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [userbot](userbot/main.go) | User authentication from terminal, session persistence, printing incoming messages | Custom `UserAuthenticator` |
| [bot-auth-manual](bot-auth-manual/main.go) | Bot authentication | `session.Storage`, setup without environment variables |
| [bot-echo](bot-echo/main.go) | Echo bot | UpdateDispatcher, message sender |
| [bot-upload](bot-upload/main.go) | One-shot uploader for bot | NoUpdates flag, uploads with MIME, custom file name and as audio, resolving peer by username, HTML message |
| [gif-download](gif-download/main.go) | Saved gif backup (and restore) for user | Download, upload, middlewares with rate limit, unpack |
| [bg-run](bg-run/main.go) | Using client without Run | contrib/bg package |
| [pretty-print](pretty-print/main.go) | Pretty-print requests, responses and updates | The tgp package, middleware and custom UpdateHandler for all updates |
| [updates](updates/main.go) | Updates engine example | The `updates` package that recovers missed updates |
| Name | Description | Features |
|--------------------------------------------|-------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [userbot](userbot/main.go) | Userbot example with peer storage and flood wait middelware | Custom auth flow, `session.Storage`, `PeerStorage`, `ResolverCache` |
| [bot-auth-manual](bot-auth-manual/main.go) | Bot authentication | `session.Storage`, setup without environment variables |
| [bot-echo](bot-echo/main.go) | Echo bot | UpdateDispatcher, message sender |
| [bot-upload](bot-upload/main.go) | One-shot uploader for bot | NoUpdates flag, uploads with MIME, custom file name and as audio, resolving peer by username, HTML message |
| [gif-download](gif-download/main.go) | Saved gif backup (and restore) for user | Download, upload, middlewares with rate limit, unpack |
| [bg-run](bg-run/main.go) | Using client without Run | contrib/bg package |
| [pretty-print](pretty-print/main.go) | Pretty-print requests, responses and updates | The tgp package, middleware and custom UpdateHandler for all updates |
| [updates](updates/main.go) | Updates engine example | The `updates` package that recovers missed updates |

## Environment variables

Expand Down
23 changes: 19 additions & 4 deletions examples/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,46 @@ module github.com/gotd/td/examples
go 1.19

require (
github.com/cockroachdb/pebble v0.0.0-20220107203702-aa376a819bf6
github.com/go-faster/errors v0.6.1
github.com/gotd/contrib v0.15.0
github.com/gotd/td v0.77.0
github.com/gotd/contrib v0.16.0
github.com/gotd/td v0.79.0
github.com/joho/godotenv v1.5.1
go.uber.org/atomic v1.10.0
go.uber.org/zap v1.24.0
golang.org/x/crypto v0.8.0
golang.org/x/sync v0.1.0
golang.org/x/term v0.7.0
golang.org/x/time v0.3.0
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
gopkg.in/natefinch/lumberjack.v2 v2.2.1
)

require (
github.com/DataDog/zstd v1.4.5 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.8.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f // indirect
github.com/cockroachdb/redact v1.0.8 // indirect
github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 // indirect
github.com/go-faster/jx v1.0.0 // indirect
github.com/go-faster/xor v1.0.0 // indirect
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gotd/ige v0.2.2 // indirect
github.com/gotd/neo v0.1.5 // indirect
github.com/klauspost/compress v1.16.4 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20230116083435-1de6713980de // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/term v0.7.0 // indirect
nhooyr.io/websocket v1.8.7 // indirect
rsc.io/qr v0.2.0 // indirect
)
Expand Down
Loading