Skip to content

Commit

Permalink
fix(users): just skip when encounter CHAT_ADMIN_REQUIRED
Browse files Browse the repository at this point in the history
  • Loading branch information
iyear committed Oct 23, 2023
1 parent 16efff8 commit f8daf6e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/chat/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/gotd/td/telegram/peers"
"github.com/gotd/td/telegram/query/channels/participants"
"github.com/gotd/td/tg"
"github.com/gotd/td/tgerr"
"github.com/jedib0t/go-pretty/v6/progress"
"go.uber.org/multierr"
"golang.org/x/time/rate"
Expand Down Expand Up @@ -101,6 +102,10 @@ func Users(ctx context.Context, opts UsersOptions) error {
for field, query := range fields {
iter := query.Iter()
if err = outputUsers(ctx, pw, peer, enc, field, iter, opts.Raw); err != nil {
// skip if we get CHAT_ADMIN_REQUIRED error, just export other fields
if tgerr.Is(err, tg.ErrChatAdminRequired) {
continue
}
return fmt.Errorf("failed to output %s: %w", field, err)
}
}
Expand Down

0 comments on commit f8daf6e

Please sign in to comment.