Note
These examples assume you have read full-api
.
If you need to retrieve the bio, biography or about information for a user you should use GetFullUser
:
from telethon.tl.functions.users import GetFullUserRequest
full = await client(GetFullUserRequest(user))
# or even
full = await client(GetFullUserRequest('username'))
bio = full.about
See UserFull
to know what other fields you can access.
The first name, last name and bio (about) can all be changed with the same request. Omitted fields won't change after invoking UpdateProfile
:
from telethon.tl.functions.account import UpdateProfileRequest
await client(UpdateProfileRequest(
about='This is a test from Telethon'
))
You need to use account.UpdateUsername
:
from telethon.tl.functions.account import UpdateUsernameRequest
await client(UpdateUsernameRequest('new_username'))
The easiest way is to upload a new file and use that as the profile photo through UploadProfilePhoto
:
from telethon.tl.functions.photos import UploadProfilePhotoRequest
await client(UploadProfilePhotoRequest(
await client.upload_file('/path/to/some/file')
)))