Documentation enhancements

This commit is contained in:
Lonami Exo 2018-05-06 13:03:30 +02:00
parent 2045e00563
commit f442e01560
3 changed files with 30 additions and 1 deletions

View File

@ -9,6 +9,14 @@ the ``session``, and defaults to be the session name (or full path). That is,
if you create a ``TelegramClient('anon')`` instance and connect, an if you create a ``TelegramClient('anon')`` instance and connect, an
``anon.session`` file will be created on the working directory. ``anon.session`` file will be created on the working directory.
Note that if you pass a string it will be a file in the current working
directory, although you can also pass absolute paths.
The session file contains enough information for you to login without
re-sending the code, so if you have to enter the code more than once,
maybe you're changing the working directory, renaming or removing the
file, or using random names.
These database files using ``sqlite3`` contain the required information to These database files using ``sqlite3`` contain the required information to
talk to the Telegram servers, such as to which IP the client should connect, talk to the Telegram servers, such as to which IP the client should connect,
port, authorization key so that messages can be encrypted, and so on. port, authorization key so that messages can be encrypted, and so on.

View File

@ -39,6 +39,13 @@ Note that ``'some_name'`` will be used to save your session (persistent
information such as access key and others) as ``'some_name.session'`` in information such as access key and others) as ``'some_name.session'`` in
your disk. This is by default a database file using Python's ``sqlite3``. your disk. This is by default a database file using Python's ``sqlite3``.
.. note::
It's important that the library always accesses the same session file so
that you don't need to re-send the code over and over again. By default it
creates the file in your working directory, but absolute paths work too.
Before using the client, you must be connected to Telegram. Before using the client, you must be connected to Telegram.
Doing so is very easy: Doing so is very easy:

View File

@ -104,6 +104,14 @@ class TelegramClient(TelegramBareClient):
used otherwise. If it's ``None``, the session will not be saved, used otherwise. If it's ``None``, the session will not be saved,
and you should call :meth:`.log_out()` when you're done. and you should call :meth:`.log_out()` when you're done.
Note that if you pass a string it will be a file in the current
working directory, although you can also pass absolute paths.
The session file contains enough information for you to login
without re-sending the code, so if you have to enter the code
more than once, maybe you're changing the working directory,
renaming or removing the file, or using random names.
api_id (`int` | `str`): api_id (`int` | `str`):
The API ID you obtained from https://my.telegram.org. The API ID you obtained from https://my.telegram.org.
@ -532,7 +540,8 @@ class TelegramClient(TelegramBareClient):
offset_peer=InputPeerEmpty(), _total=None): offset_peer=InputPeerEmpty(), _total=None):
""" """
Returns an iterator over the dialogs, yielding 'limit' at most. Returns an iterator over the dialogs, yielding 'limit' at most.
Dialogs are the open "chats" or conversations with other people. Dialogs are the open "chats" or conversations with other people,
groups you have joined, or channels you are subscribed to.
Args: Args:
limit (`int` | `None`): limit (`int` | `None`):
@ -738,6 +747,11 @@ class TelegramClient(TelegramBareClient):
message (`str` | :tl:`Message`): message (`str` | :tl:`Message`):
The message to be sent, or another message object to resend. The message to be sent, or another message object to resend.
The maximum length for a message is 35,000 bytes or 4,096
characters. Longer messages will not be sliced automatically,
and you should slice them manually if the text to send is
longer than said length.
reply_to (`int` | :tl:`Message`, optional): reply_to (`int` | :tl:`Message`, optional):
Whether to reply to a message or not. If an integer is provided, Whether to reply to a message or not. If an integer is provided,
it should be the ID of the message that it should reply to. it should be the ID of the message that it should reply to.