diff --git a/readthedocs/extra/advanced-usage/sessions.rst b/readthedocs/extra/advanced-usage/sessions.rst index 592d8334..a2031f16 100644 --- a/readthedocs/extra/advanced-usage/sessions.rst +++ b/readthedocs/extra/advanced-usage/sessions.rst @@ -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 ``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 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. diff --git a/readthedocs/extra/basic/creating-a-client.rst b/readthedocs/extra/basic/creating-a-client.rst index 7a110e0d..515d68ef 100644 --- a/readthedocs/extra/basic/creating-a-client.rst +++ b/readthedocs/extra/basic/creating-a-client.rst @@ -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 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. Doing so is very easy: diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py index f537fbcd..4a131f9a 100644 --- a/telethon/telegram_client.py +++ b/telethon/telegram_client.py @@ -104,6 +104,14 @@ class TelegramClient(TelegramBareClient): used otherwise. If it's ``None``, the session will not be saved, 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`): The API ID you obtained from https://my.telegram.org. @@ -532,7 +540,8 @@ class TelegramClient(TelegramBareClient): offset_peer=InputPeerEmpty(), _total=None): """ 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: limit (`int` | `None`): @@ -738,6 +747,11 @@ class TelegramClient(TelegramBareClient): message (`str` | :tl:`Message`): 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): 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.