From 2a231d4c63e50dc03a4b55801df59f461dcc756d Mon Sep 17 00:00:00 2001 From: Kyle2142 <19349418+Kyle2142@users.noreply.github.com> Date: Thu, 20 Dec 2018 11:41:12 +0200 Subject: [PATCH] Fix caption default inconsistency Setting caption to None, like most other optional parameters accept, would throw a ValueError --- telethon/client/uploads.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/telethon/client/uploads.py b/telethon/client/uploads.py index 4b6e3dbe..3362b63a 100644 --- a/telethon/client/uploads.py +++ b/telethon/client/uploads.py @@ -20,7 +20,7 @@ class UploadMethods(ButtonMethods, MessageParseMethods, UserMethods): # region Public methods async def send_file( - self, entity, file, *, caption='', force_document=False, + self, entity, file, *, caption=None, force_document=False, progress_callback=None, reply_to=None, attributes=None, thumb=None, allow_cache=True, parse_mode=(), voice_note=False, video_note=False, buttons=None, silent=None, @@ -116,6 +116,8 @@ class UploadMethods(ButtonMethods, MessageParseMethods, UserMethods): The `telethon.tl.custom.message.Message` (or messages) containing the sent file, or messages if a list of them was passed. """ + if not caption: + caption = '' # First check if the user passed an iterable, in which case # we may want to send as an album if all are photo files. if utils.is_list_like(file):