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

chore: don't resolve on start #1056

Merged
merged 1 commit into from
Apr 16, 2023
Merged
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
12 changes: 5 additions & 7 deletions examples/userbot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ func run(ctx context.Context) error {

// Setting up resolver cache that will use peer storage.
resolver := storage.NewResolverCache(peer.Plain(api), peerDB)
// Usage:
// if _, err := resolver.ResolveDomain(ctx, "tdlibchat"); err != nil {
// return errors.Wrap(err, "resolve")
// }
_ = resolver

// Registering handler for new private messages.
dispatcher.OnNewMessage(func(ctx context.Context, e tg.Entities, u *tg.UpdateNewMessage) error {
Expand Down Expand Up @@ -258,13 +263,6 @@ func run(ctx context.Context) error {
fmt.Println("Filled")
}

lg.Info("Resolving https://t.me/tdlibchat")
// This should be cached in peer storage after first time.
if _, err := resolver.ResolveDomain(ctx, "tdlibchat"); err != nil {
return errors.Wrap(err, "resolve")
}
lg.Info("Resolved")

// Waiting until context is done.
fmt.Println("Listening for updates. Interrupt (Ctrl+C) to stop.")
<-ctx.Done()
Expand Down