Clarify some docstrings

This commit is contained in:
Lonami Exo 2019-03-10 13:29:34 +01:00
parent baa8970bb6
commit 8884015dae
2 changed files with 30 additions and 9 deletions

View File

@ -612,7 +612,8 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods):
from_peer (`entity`): from_peer (`entity`):
If the given messages are integer IDs and not instances If the given messages are integer IDs and not instances
of the ``Message`` class, this *must* be specified in of the ``Message`` class, this *must* be specified in
order for the forward to work. order for the forward to work. This parameter indicates
the entity from which the messages should be forwarded.
silent (`bool`, optional): silent (`bool`, optional):
Whether the message should notify people in a broadcast Whether the message should notify people in a broadcast

View File

@ -95,15 +95,35 @@ class UploadMethods(ButtonMethods, MessageParseMethods, UserMethods):
Who will receive the file. Who will receive the file.
file (`str` | `bytes` | `file` | `media`): file (`str` | `bytes` | `file` | `media`):
The path of the file, byte array, or stream that will be sent. The file to send, which can be one of:
Note that if a byte array or a stream is given, a filename
or its type won't be inferred, and it will be sent as an
"unnamed application/octet-stream".
Furthermore the file may be any media (a message, document, * A local file path to an in-disk file. The file name
photo or similar) so that it can be resent without the need will be the path's base name.
to download and re-upload it again. Bot API ``file_id``
format is also supported. * A `bytes` byte array with the file's data to send
(for example, by using ``text.encode('utf-8')``).
A default file name will be used.
* A bytes `io.IOBase` stream over the file to send
(for example, by using ``open(file, 'rb')``).
Its ``.name`` property will be used for the file name,
or a default if it doesn't have one.
* An external URL to a file over the internet. This will
send the file as "external" media, and Telegram is the
one that will fetch the media and send it.
* A Bot API-like ``file_id``. You can convert previously
sent media to file IDs for later reusing with
`telethon.utils.pack_bot_file_id`.
* A handle to an existing file (for example, if you sent a
message with media before, you can use its ``message.media``
as a file here).
* A handle to an uploaded file (from `upload_file`).
To send an album, you should provide a list in this parameter.
If a list or similar is provided, the files in it will be If a list or similar is provided, the files in it will be
sent as an album in the order in which they appear, sliced sent as an album in the order in which they appear, sliced