Chat.set_photo()¶
- Chat.set_photo()¶
Bound method set_photo of
Chat
.Use as a shortcut for:
await client.set_chat_photo( chat_id=chat_id, photo=photo )
Example
# Set chat photo using a local file await chat.set_photo(photo="photo.jpg") # Set chat photo using an existing Photo file_id await chat.set_photo(photo=photo.file_id) # set chat photo with emoji await chat.set_photo(photo="photo.jpg", emoji=5366316836101038579) # set chat photo with emoji and emoji_background await chat.set_photo(photo="photo.jpg", emoji=5366316836101038579, emoji_background=[0, 0, 0, 0]) # Set chat video await chat.set_photo(video="video.mp4")
- Parameters:¶
photo (
str
|BinaryIO
, optional) – New chat photo. You can pass aPhoto
file_id, a file path to upload a new photo from your local machine or a binary file-like object with its attribute “.name” set for in-memory uploads.emoji (
int
, optional) – Unique identifier (int) of the emoji to be used as the chat photo.emoji_background (
int
| List ofint
, optional) – hexadecimal colors or List of hexadecimal colors to be used as the chat photo background.video (
str
|BinaryIO
, optional) – New chat video. You can pass a file path to upload a new video from your local machine or a binary file-like object with its attribute “.name” set for in-memory uploads.video_start_ts (
float
, optional) – The timestamp in seconds of the video frame to use as photo profile preview.
- Returns:¶
Message
|bool
– On success, a service message will be returned (when applicable), otherwise, in case a message object couldn’t be returned, True is returned.- Raises:¶
RPCError – In case of a Telegram RPC error.
ValueError – if a chat_id belongs to user.