Skip to main content

photos.uploadProfilePhoto

Updates current user profile photo. The file, video and video_emoji_markup flags are mutually exclusive.

func (c *Client) PhotosUploadProfilePhoto(ctx context.Context, request *PhotosUploadProfilePhotoRequest) (*PhotosPhoto, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.PhotosUploadProfilePhoto(ctx, &tg.PhotosUploadProfilePhotoRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // *PhotosPhoto
return nil
})

Parameters

NameTypeRequiredDescription
FallbackboolIf set, the chosen profile photo will be shown to users that can't display your main profile photo due to your privacy settings.
BotInputUserClassCan contain info of a bot we own, to change the profile photo of that bot, instead of the current user.
FileInputFileClassProfile photo
VideoInputFileClassAnimated profile picture video
VideoStartTsfloat64Floating 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.
VideoEmojiMarkupVideoSizeClassAnimated sticker profile picture, must contain either a videoSizeEmojiMarkup or a videoSizeStickerMarkup constructor.

Returns

*PhotosPhoto

Possible errors

CodeTypeDescription
400ALBUM_PHOTOS_TOO_MANYYou have uploaded too many profile photos, delete some before retrying.
400BOT_INVALIDThis is not a valid bot.
400EMOJI_MARKUP_INVALIDThe specified video_emoji_markup was invalid.
400FILE_PARTS_INVALIDThe number of file parts is invalid.
400IMAGE_PROCESS_FAILEDFailure while processing image.
400PHOTO_CROP_FILE_MISSINGPhoto crop file missing.
400PHOTO_CROP_SIZE_SMALLPhoto is too small.
400PHOTO_EXT_INVALIDThe extension of the photo is invalid.
400PHOTO_FILE_MISSINGProfile photo file missing.
400PHOTO_INVALIDPhoto invalid.
400STICKER_MIME_INVALIDThe specified sticker MIME type is invalid.
400VIDEO_FILE_INVALIDThe specified video file is invalid.

References