diff --git a/telethon/client/downloads.py b/telethon/client/downloads.py index 06368428..d7ae5a9c 100644 --- a/telethon/client/downloads.py +++ b/telethon/client/downloads.py @@ -223,7 +223,8 @@ class DownloadMethods: The output file path, directory, or stream-like object. If the path exists and is a file, it will be overwritten. If file is the type `bytes`, it will be downloaded in-memory - as a bytestring (e.g. ``file=bytes``). + and returned as a bytestring (i.e. ``file=bytes``, without + parentheses or quotes). download_big (`bool`, optional): Whether to use the big version of the available photos. @@ -333,7 +334,8 @@ class DownloadMethods: The output file path, directory, or stream-like object. If the path exists and is a file, it will be overwritten. If file is the type `bytes`, it will be downloaded in-memory - as a bytestring (e.g. ``file=bytes``). + and returned as a bytestring (i.e. ``file=bytes``, without + parentheses or quotes). progress_callback (`callable`, optional): A callback function accepting two parameters: @@ -376,6 +378,9 @@ class DownloadMethods: path = await message.download_media() await message.download_media(filename) + # Downloading to memory + blob = await client.download_media(message, bytes) + # Printing download progress def callback(current, total): print('Downloaded', current, 'out of', total, diff --git a/telethon_generator/data/errors.csv b/telethon_generator/data/errors.csv index cd4517c4..374362bc 100644 --- a/telethon_generator/data/errors.csv +++ b/telethon_generator/data/errors.csv @@ -427,6 +427,7 @@ STICKER_FILE_INVALID,400,Sticker file invalid STICKER_GIF_DIMENSIONS,400,The specified video sticker has invalid dimensions STICKER_ID_INVALID,400,The provided sticker ID is invalid STICKER_INVALID,400,The provided sticker is invalid +STICKER_MIME_INVALID,400,Make sure to pass a valid image file for the right InputFile parameter STICKER_PNG_DIMENSIONS,400,Sticker png dimensions invalid STICKER_PNG_NOPNG,400,Stickers must be a png file but the used image was not a png STICKER_TGS_NODOC,400,You must send the animated sticker as a document diff --git a/telethon_generator/data/methods.csv b/telethon_generator/data/methods.csv index 610e1d13..8c5d0284 100644 --- a/telethon_generator/data/methods.csv +++ b/telethon_generator/data/methods.csv @@ -332,7 +332,7 @@ phone.toggleGroupCallSettings,user,GROUPCALL_NOT_MODIFIED photos.deletePhotos,user, photos.getUserPhotos,both,MAX_ID_INVALID USER_ID_INVALID photos.updateProfilePhoto,user,PHOTO_ID_INVALID -photos.uploadProfilePhoto,user,ALBUM_PHOTOS_TOO_MANY FILE_PARTS_INVALID IMAGE_PROCESS_FAILED PHOTO_CROP_SIZE_SMALL PHOTO_EXT_INVALID VIDEO_FILE_INVALID +photos.uploadProfilePhoto,user,ALBUM_PHOTOS_TOO_MANY FILE_PARTS_INVALID IMAGE_PROCESS_FAILED PHOTO_CROP_SIZE_SMALL PHOTO_EXT_INVALID STICKER_MIME_INVALID VIDEO_FILE_INVALID ping,both, reqDHParams,both, reqPq,both,