UploadProfilePhotoRequest
Only users can use this request. See code examples.
---functions--- photos.uploadProfilePhoto#0388a3b5 flags:# fallback:flags.3?true bot:flags.5?InputUser file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.4?VideoSize = photos.Photo
Returns
photos.Photo |
This type can only be an instance of:
Photo |
Parameters
fallback | flag | This argument defaults to None and can be omitted. |
bot | InputUser | This argument defaults to None and can be omitted. Anything entity-like will work if the library can find its Input version (e.g., usernames, Peer , User or Channel objects, etc.). |
file | InputFile | This argument defaults to None and can be omitted. |
video | InputFile | This argument defaults to None and can be omitted. |
video_start_ts | double | This argument defaults to None and can be omitted. |
video_emoji_markup | VideoSize | This argument defaults to None and can be omitted. |
Known RPC errors
This request can cause 7 known errors:
AlbumPhotosTooManyError | Too many photos were included in the album. |
FilePartsInvalidError | The number of file parts is invalid. |
ImageProcessFailedError | Failure while processing image. |
PhotoCropSizeSmallError | Photo is too small. |
PhotoExtInvalidError | The extension of the photo is invalid. |
StickerMimeInvalidError | Make sure to pass a valid image file for the right InputFile parameter. |
VideoFileInvalidError | The given video cannot be used. |
You can import these from telethon.errors
.
Example
from telethon.sync import TelegramClient from telethon import functions, types with TelegramClient(name, api_id, api_hash) as client: result = client(functions.photos.UploadProfilePhotoRequest( fallback=True, bot='username', file=client.upload_file('/path/to/file.jpg'), video=client.upload_file('/path/to/file.mp4'), video_start_ts=7.13, video_emoji_markup=types.VideoSize( type='some string here', w=42, h=42, size=42, video_start_ts=7.13 ) )) print(result.stringify())