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

client.UsersGetUsers doesn't return users with ID of type int64 #1266

Open
hbourgeot opened this issue Dec 17, 2023 · 0 comments
Open

client.UsersGetUsers doesn't return users with ID of type int64 #1266

hbourgeot opened this issue Dec 17, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@hbourgeot
Copy link

What version of gotd are you using?

go list -m github.com/gotd/td

github.com/gotd/td v0.90.0

Can this issue be reproduced with the latest version?

Yes

What did you do?

  1. Initialize the client
func initClient() (*gotgproto.Client, error) {
    clientType := gotgproto.ClientType{
    BotToken: os.Getenv("TELEGRAM_BOT_URL"),
    }

    appId, _ := strconv.Atoi(os.Getenv("APP_ID"))
    apiHash := os.Getenv("API_HASH")

    client, err := gotgproto.NewClient(
            appId,
            apiHash,
            clientType,
            &gotgproto.ClientOpts{Session: sessionMaker.NewInMemorySession(":memory:", 1)},
        )
    if err != nil {
        return nil, err
    }

    return client, nil

}
  1. Use the client for get the users
func getUser(users []tg.PeerClass, client *tg.Client, ctx context.Context) ([]*tg.User, error) {
    var usersArray []*tg.User
    var inputUsers []tg.InputUserClass

    for _, user := range users {
        switch u := user.(type) {
        case *tg.PeerUser:
        inputUsers = append(inputUsers, &tg.InputUser{UserID: u.GetUserID()})
        default:
        continue
        }
    }

    fmt.Println(len(inputUsers)) // 2

    usersClass, err := client.UsersGetUsers(ctx, inputUsers)
    if err != nil {
        return nil, err
    }

    fmt.Println(len(usersClass)) // 1

    for _, user := range usersClass {
        switch u := user.(type) {
        case *tg.User:
        usersArray = append(usersArray, u)
        default:
        continue
        }
    }

    return usersArray, nil

}

What did you expect to see?

Obtain users who have IDs of any number of digits

What did you see instead?

The client is only returning those users who have IDs less than 999,999,999, without giving any error or warning in the terminal.

What Go version and environment are you using?

go version #1.21.4
go env Output
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\rost\AppData\Local\go-build
set GOENV=C:\Users\rost\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\rost\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\rost\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:/Program Files/Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21.4
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=C:\Users\rost\Documents\GitHub\quoteit\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\rost\AppData\Local\Temp\go-build4208149312=/tmp/go-bu
ild -gno-record-gcc-switches
@hbourgeot hbourgeot added the bug Something isn't working label Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant