Layer 220
method Users Bots

Parameters

Name Type Description
Flags # Flags, see TL conditional fields
Fallback flags.3?true If set, the chosen profile photo will be shown to users that can't display your main profile photo due to your privacy settings.
Bot flags.5?InputUser Can contain info of a bot we own, to change the profile photo of that bot, instead of the current user.
File flags.0?InputFile Profile photo
Video flags.1?InputFile Animated profile picture video
VideoStartTs flags.2?double Floating point UNIX timestamp in seconds, indicating the frame of the video/sticker that should be used as static preview; can only be used if video or video_emoji_markup is set.
VideoEmojiMarkup flags.4?VideoSize Animated sticker profile picture, must contain either a video Size Emoji Markup or a video Size Sticker Markup constructor.

Returns

photos.Photo

Possible Errors

Code Type Description
400 ALBUM_PHOTOS_TOO_MANY You have uploaded too many profile photos, delete some before retrying.
400 BOT_INVALID This is not a valid bot.
400 EMOJI_MARKUP_INVALID The specified video_emoji_markup was invalid.
400 FILE_PARTS_INVALID The number of file parts is invalid.
400 IMAGE_PROCESS_FAILED Failure while processing image.
400 PHOTO_CROP_FILE_MISSING Photo crop file missing.
400 PHOTO_CROP_SIZE_SMALL Photo is too small.
400 PHOTO_EXT_INVALID The extension of the photo is invalid.
400 PHOTO_FILE_MISSING Profile photo file missing.
400 PHOTO_INVALID Photo invalid.
400 STICKER_MIME_INVALID The specified sticker MIME type is invalid.
400 VIDEO_FILE_INVALID The specified video file is invalid.

Gogram Example

// PhotosUploadProfilePhoto - using Params struct
result, err := client.PhotosUploadProfilePhoto(&tg.PhotosUploadProfilePhotoParams{

    // Optional fields:
    // Fallback: true,
    // Bot: &tg.InputUserSelf{},
    // File: &tg.InputFile{ID: int64(0), Parts: 1, Name: "file.dat"},
    // Video: &tg.InputFile{ID: int64(0), Parts: 1, Name: "file.dat"},
    // ...
})
if err != nil {
    // handle error
}
// result is *tg.PhotosPhoto