Created
June 8, 2017 18:33
-
-
Save JosXa/7defefb6b64a09fca7b16c557019ffbc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| import time | |
| import random | |
| from telethon import InteractiveTelegramClient | |
| from telethon.tl.functions.photos import UploadProfilePhotoRequest | |
| import os | |
| client = InteractiveTelegramClient( | |
| 'test1', | |
| '+400000000000', | |
| api_id=34057, | |
| api_hash='blabla' | |
| ) | |
| photo_folder = 'blabla' | |
| while True: | |
| photos = os.listdir(photo_folder) | |
| for photo in photos: | |
| input_file = client.upload_file(photo_folder + photo) | |
| result = client.invoke(UploadProfilePhotoRequest(input_file)) | |
| print('Profile picture changed to {}.'.format(photo)) | |
| time.sleep(45) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You have to call
UpdateProfilePhotoRequestafter you've uploaded the input file as a photo.