Make .download_profile_photo() more friendly

This commit is contained in:
Lonami Exo
2017-08-23 01:35:12 +02:00
parent 9d15008f09
commit 8ed77418bf
2 changed files with 68 additions and 21 deletions

View File

@@ -206,12 +206,13 @@ class InteractiveTelegramClient(TelegramClient):
# Download profile photo
elif msg == '!dp':
output = str('usermedia/propic_{}'.format(entity.id))
print('Downloading profile picture...')
success = self.download_profile_photo(entity.photo, output)
if success:
print('Profile picture downloaded to {}'.format(
output))
print('Downloading profile picture to usermedia/...')
os.makedirs('usermedia', exist_ok=True)
output = self.download_profile_photo(entity, 'usermedia')
if output:
print(
'Profile picture downloaded to {}'.format(output)
)
else:
print('No profile picture found for this user.')