From 9275a9fcbbcfcaa4bfbf6a271589095dd4d92bb1 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Wed, 19 Sep 2018 17:51:18 +0200 Subject: [PATCH] Fix several typos and misleading docs (#987, #990) --- readthedocs/extra/examples/telegram-client.rst | 6 +++--- telethon/client/users.py | 15 ++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/readthedocs/extra/examples/telegram-client.rst b/readthedocs/extra/examples/telegram-client.rst index 1a341829..c6ea8aa0 100644 --- a/readthedocs/extra/examples/telegram-client.rst +++ b/readthedocs/extra/examples/telegram-client.rst @@ -185,7 +185,7 @@ It's easy to `download_profile_photo .. code-block:: python - client.download_profile_method(user) + client.download_profile_photo(user) Or `download_media ` from a message: @@ -298,7 +298,7 @@ Now all messages will be formatted as HTML by default: .. code-block:: python client.send_message('me', 'Some bold and italic text') - client.send_message('me', 'An URL') + client.send_message('me', 'An URL') client.send_message('me', 'code and
pre\nblocks
') client.send_message('me', 'Mentions') @@ -336,7 +336,7 @@ You can send voice notes or round videos by setting the right arguments: .. code-block:: python client.send_file(chat, '/my/songs/song.mp3', voice_note=True) - client.send_file(chat, '/my/videos/video.mp3', video_note=True) + client.send_file(chat, '/my/videos/video.mp4', video_note=True) You can set a JPG thumbnail for any document: diff --git a/telethon/client/users.py b/telethon/client/users.py index 757fa7f9..82d2c4ab 100644 --- a/telethon/client/users.py +++ b/telethon/client/users.py @@ -244,11 +244,15 @@ class UserMethods(TelegramBaseClient): >>> chat = rc(client.get_input_entity(-123456789)) entity (`str` | `int` | :tl:`Peer` | :tl:`InputPeer`): - If an username is given, **the library will use the cache**. This - means that it's possible to be using an username that *changed*. + If an username or invite link is given, **the library will + use the cache**. This means that it's possible to be using + an username that *changed* or an old invite link (this only + happens if an invite link for a small group chat is used + after it was upgraded to a mega-group). - If the username is not found in the cache, it will be fetched. - The same rules apply to phone numbers (``'+34 123456789'``). + If the username or ID from the invite link is not found in + the cache, it will be fetched. The same rules apply to phone + numbers (``'+34 123456789'``). If an exact name is given, it must be in the cache too. This is not reliable as different people can share the same name @@ -268,9 +272,6 @@ class UserMethods(TelegramBaseClient): If the given object can be turned into an input entity directly, said operation will be done. - Invite links make an API call **always** and are expensive. - You should use the chat ID instead. - Unsupported types will raise ``TypeError``. If the entity can't be found, ``ValueError`` will be raised.