Fix several typos and misleading docs (#987, #990)

This commit is contained in:
Lonami Exo 2018-09-19 17:51:18 +02:00
parent 5e13a6f7a8
commit 9275a9fcbb
2 changed files with 11 additions and 10 deletions

View File

@ -185,7 +185,7 @@ It's easy to `download_profile_photo
.. code-block:: python .. code-block:: python
client.download_profile_method(user) client.download_profile_photo(user)
Or `download_media <telethon.client.downloads.DownloadMethods.download_media>` Or `download_media <telethon.client.downloads.DownloadMethods.download_media>`
from a message: from a message:
@ -298,7 +298,7 @@ Now all messages will be formatted as HTML by default:
.. code-block:: python .. code-block:: python
client.send_message('me', 'Some <b>bold</b> and <i>italic</i> text') client.send_message('me', 'Some <b>bold</b> and <i>italic</i> text')
client.send_message('me', 'An <a href="https://example.com">URL</b>') client.send_message('me', 'An <a href="https://example.com">URL</a>')
client.send_message('me', '<code>code</code> and <pre>pre\nblocks</pre>') client.send_message('me', '<code>code</code> and <pre>pre\nblocks</pre>')
client.send_message('me', '<a href="tg://user?id=me">Mentions</a>') client.send_message('me', '<a href="tg://user?id=me">Mentions</a>')
@ -336,7 +336,7 @@ You can send voice notes or round videos by setting the right arguments:
.. code-block:: python .. code-block:: python
client.send_file(chat, '/my/songs/song.mp3', voice_note=True) 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: You can set a JPG thumbnail for any document:

View File

@ -244,11 +244,15 @@ class UserMethods(TelegramBaseClient):
>>> chat = rc(client.get_input_entity(-123456789)) >>> chat = rc(client.get_input_entity(-123456789))
entity (`str` | `int` | :tl:`Peer` | :tl:`InputPeer`): entity (`str` | `int` | :tl:`Peer` | :tl:`InputPeer`):
If an username is given, **the library will use the cache**. This If an username or invite link is given, **the library will
means that it's possible to be using an username that *changed*. 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. If the username or ID from the invite link is not found in
The same rules apply to phone numbers (``'+34 123456789'``). 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 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 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, If the given object can be turned into an input entity directly,
said operation will be done. 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``. Unsupported types will raise ``TypeError``.
If the entity can't be found, ``ValueError`` will be raised. If the entity can't be found, ``ValueError`` will be raised.