I was trying to find some documentation, but i`ve failed. I would be grateful if you send me doc or example how to do it.
Asked
Active
Viewed 1,800 times
2 Answers
1
In order to change your profile photo you should use MTPROTOAPI. One of the good libraries written in Python is called telethon. You can check here on how to update profile information.
install telethon:
python3 -m pip install --upgrade telethon
update profile photo:
import asyncio
from telethon import TelegramClient
from telethon.tl.functions.photos import UploadProfilePhotoRequest
# Use your own values from my.telegram.org
api_id = 12345
api_hash = '0123456789abcdef0123456789abcdef'
client = await TelegramClient('anon', api_id, api_hash)
await client(UploadProfilePhotoRequest(
await client.upload_file('/path/to/some/file')
))

Ali Padida
- 1,763
- 1
- 16
- 34
-
Would this also work for a user account? – rokejulianlockhart Jun 07 '23 at 13:36