tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

Can't setProfilePhoto #2718

Closed NewK1ng closed 10 months ago

NewK1ng commented 10 months ago

I'm trying to set profile photo using this piece of code (Java):

        TdApi.InputFileLocal inputFile = new TdApi.InputFileLocal(path);

        client.send(new TdApi.SetProfilePhoto(new TdApi.InputChatPhotoStatic(inputFile), true), object -> {

            switch (object.getConstructor()) {

                case TdApi.Ok.CONSTRUCTOR -> {
                    System.out.println("Profile photo uploaded");
                }

                default -> {
                    System.out.println("Can't set profile photo");
                }
            }
        });

Server returns Ok, but the profile doesn’t have this photo. What am I doing wrong? Should I somehow update profile or what?

NewK1ng commented 10 months ago

You need to specify the absolute path to the photo, not the local. Closed