From b0883148f5255e63cd8feb524c9de18507b5e069 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 17 Jan 2019 16:51:50 +0100 Subject: [PATCH] Document more RPC errors These two occur when replying to an inline query with a photo and InputBotInlineMessageMediaAuto empty message, and passing URLs to PNGs that may not be accessible (i.e. 403 from pixiv). --- telethon/client/downloads.py | 10 ++++++++++ telethon_generator/data/errors.csv | 2 ++ telethon_generator/data/methods.csv | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/telethon/client/downloads.py b/telethon/client/downloads.py index 65ac8880..6490b235 100644 --- a/telethon/client/downloads.py +++ b/telethon/client/downloads.py @@ -26,6 +26,16 @@ class DownloadMethods(UserMethods): entity (`entity`): From who the photo will be downloaded. + .. note:: + + This method expects the full entity (which has the data + to download the photo), not an input variant. + + It's possible that sometimes you can't fetch the entity + from its input (since you can get errors like + ``ChannelPrivateError``) but you already have it through + another call, like getting a forwarded message from it. + file (`str` | `file`, optional): The output file path, directory, or stream-like object. If the path exists and is a file, it will be overwritten. diff --git a/telethon_generator/data/errors.csv b/telethon_generator/data/errors.csv index a2b00fad..6721d1cb 100644 --- a/telethon_generator/data/errors.csv +++ b/telethon_generator/data/errors.csv @@ -166,11 +166,13 @@ PHONE_NUMBER_OCCUPIED,400,The phone number is already in use PHONE_NUMBER_UNOCCUPIED,400,The phone number is not yet being used PHONE_PASSWORD_FLOOD,406,You have tried logging in too many times PHONE_PASSWORD_PROTECTED,400,This phone is password protected +PHOTO_CONTENT_URL_EMPTY,400,The content from the URL used as a photo appears to be empty or has caused another HTTP error PHOTO_CROP_SIZE_SMALL,400,Photo is too small PHOTO_EXT_INVALID,400,The extension of the photo is invalid PHOTO_INVALID,400,Photo invalid PHOTO_INVALID_DIMENSIONS,400,The photo dimensions are invalid PHOTO_SAVE_FILE_INVALID,400,The photo you tried to send cannot be saved by Telegram. A reason may be that it exceeds 10MB. Try resizing it locally +PHOTO_THUMB_URL_EMPTY,400,The URL used as a thumbnail appears to be empty or has caused another HTTP error PIN_RESTRICTED,400,You can't pin messages in private chats with other people PRIVACY_KEY_INVALID,400,The privacy key is invalid PTS_CHANGE_EMPTY,500,No PTS change diff --git a/telethon_generator/data/methods.csv b/telethon_generator/data/methods.csv index 795ba345..f2d2f04d 100644 --- a/telethon_generator/data/methods.csv +++ b/telethon_generator/data/methods.csv @@ -147,7 +147,7 @@ messages.setBotPrecheckoutResults,unknown,ERROR_TEXT_EMPTY messages.setBotShippingResults,unknown,QUERY_ID_INVALID messages.setEncryptedTyping,user,CHAT_ID_INVALID messages.setGameScore,unknown,PEER_ID_INVALID USER_BOT_REQUIRED -messages.setInlineBotResults,unknown,ARTICLE_TITLE_EMPTY BUTTON_DATA_INVALID BUTTON_TYPE_INVALID BUTTON_URL_INVALID MESSAGE_EMPTY QUERY_ID_INVALID REPLY_MARKUP_INVALID RESULT_TYPE_INVALID SEND_MESSAGE_MEDIA_INVALID SEND_MESSAGE_TYPE_INVALID START_PARAM_INVALID USER_BOT_INVALID +messages.setInlineBotResults,unknown,ARTICLE_TITLE_EMPTY BUTTON_DATA_INVALID BUTTON_TYPE_INVALID BUTTON_URL_INVALID MESSAGE_EMPTY PHOTO_CONTENT_URL_EMPTY PHOTO_THUMB_URL_EMPTY QUERY_ID_INVALID REPLY_MARKUP_INVALID RESULT_TYPE_INVALID SEND_MESSAGE_MEDIA_INVALID SEND_MESSAGE_TYPE_INVALID START_PARAM_INVALID USER_BOT_INVALID messages.setInlineGameScore,unknown,MESSAGE_ID_INVALID USER_BOT_REQUIRED messages.setTyping,unknown,CHANNEL_INVALID CHANNEL_PRIVATE CHAT_ID_INVALID CHAT_WRITE_FORBIDDEN PEER_ID_INVALID USER_BANNED_IN_CHANNEL USER_IS_BLOCKED USER_IS_BOT messages.startBot,user,BOT_INVALID PEER_ID_INVALID START_PARAM_EMPTY START_PARAM_INVALID