rubenlagus / TelegramApi

Java library to create Telegram Clients
MIT License
300 stars 108 forks source link

TLRequestPhotoGetUserPhotos not working #52

Closed sadeghpro closed 4 years ago

sadeghpro commented 6 years ago

hi I use TLRequestPhotoGetUserPhotos to get all user profile photo

TLRequestPhotosGetUserPhotos photoRequest = new TLRequestPhotosGetUserPhotos();
photoRequest.setLimit(1);
photoRequest.setMaxId(-1l);
photoRequest.setOffset(0);
TLInputUser inputUser = new TLInputUser();
inputUser.setAccessHash(tlUser.getAccessHash());
inputUser.setUserId(tlUser.getId());
photoRequest.setUserId(inputUser);
try {
    TLAbsPhotos photos = kernel.getKernelComm().getApi().doRpcCall(photoRequest, 50000000);
    System.out.println("photos: " + photos.getPhotos().size() + " users: " + photos.getUsers().size());                                        
} catch (IOException | TimeoutException ex) {
    Logger.getLogger(Deepthought.class.getName()).log(Level.SEVERE, null, ex);
}

but it's back error to me

WARNING: [TELEGRAMAPI] photos.getUserPhotos#91cd32a8
Feb 01, 2018 9:56:49 AM org.telegram.Deepthought lambda$null$0
SEVERE: null
org.telegram.api.engine.RpcException: MAX_ID_INVALID
    at org.telegram.api.engine.TelegramApi$2.onError(TelegramApi.java:343)
    at org.telegram.api.engine.TelegramApi$ProtoCallback.onRpcError(TelegramApi.java:857)
    at org.telegram.mtproto.MTProto.onMTProtoMessage(MTProto.java:386)
    at org.telegram.mtproto.MTProto.onMTMessage(MTProto.java:258)
    at org.telegram.mtproto.MTProto.access$1300(MTProto.java:45)
    at org.telegram.mtproto.MTProto$ResponseProcessor.run(MTProto.java:766)

then I check maxId. in the telegram core maxId is an integer not a long then I change it to integer in TLRequestPhotoGetUserPhotos class but another error occur

WARNING: [TELEGRAMAPI] photos.getUserPhotos#91cd32a8
Feb 01, 2018 9:52:04 AM org.telegram.Deepthought lambda$null$0
SEVERE: null
org.telegram.api.engine.RpcException: INPUT_FETCH_ERROR
    at org.telegram.api.engine.TelegramApi$2.onError(TelegramApi.java:343)
    at org.telegram.api.engine.TelegramApi$ProtoCallback.onRpcError(TelegramApi.java:857)
    at org.telegram.mtproto.MTProto.onMTProtoMessage(MTProto.java:386)
    at org.telegram.mtproto.MTProto.onMTMessage(MTProto.java:258)
    at org.telegram.mtproto.MTProto.access$1300(MTProto.java:45)
    at org.telegram.mtproto.MTProto$ResponseProcessor.run(MTProto.java:766)

I see this issue but first error occur again. I use Layer 66.2