Is there a way to change avatar in telegram bot using python?

Question:

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 By: qruim

||

Answers:

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')
))
Answered By: Ali Padida

For those who just want to change without programmatically:

  1. Send the command /setuserpic to the bot responsible for creating other @BotFather bots.
  2. Send an image to the dialog that will be set as the bot’s avatar.

enter image description here

Source

Answered By: Scott