1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Update apihelper.py

This commit is contained in:
mrpes 2020-07-31 10:45:58 +05:00 committed by GitHub
parent 0ab908705b
commit 97aa9637cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -329,10 +329,12 @@ def send_photo(
method_url = r'sendPhoto'
payload = {'chat_id': chat_id}
files = None
if not util.is_string(photo):
files = {'photo': photo}
else:
if util.is_string(photo):
payload['photo'] = photo
elif util.is_pil_image(photo):
files = {'photo': util.pil_image_to_file(photo)}
else:
files = {'photo': photo}
if caption:
payload['caption'] = caption
if reply_to_message_id:
@ -743,10 +745,12 @@ def set_chat_photo(token, chat_id, photo):
method_url = 'setChatPhoto'
payload = {'chat_id': chat_id}
files = None
if not util.is_string(photo):
files = {'photo': photo}
else:
if util.is_string(photo):
payload['photo'] = photo
elif util.is_pil_image(photo):
files = {'photo': util.pil_image_to_file(photo)}
else:
files = {'photo': photo}
return _make_request(token, method_url, params=payload, files=files, method='post')