Document get_messages has no default limit

This commit is contained in:
Lonami Exo 2024-04-03 16:49:47 +02:00
parent bf3e3d8797
commit c9006024e2
2 changed files with 15 additions and 1 deletions

View File

@ -93,7 +93,7 @@ For more information, see the :doc:`/concepts/datacenters` concept.
AttributeError: 'coroutine' object has no attribute 'id' AttributeError: 'coroutine' object has no attribute 'id'
-------------------------------------------------------- --------------------------------------------------------
Telethon is an asynchronous library, which means you must ``await`` calls that require network access: Telethon is an asynchronous library, which means you must :keyword:`await` calls that require network access:
.. code-block:: python .. code-block:: python

View File

@ -825,6 +825,12 @@ class Client:
:param limit: :param limit:
How many messages to fetch at most. How many messages to fetch at most.
.. caution::
By default, there is no limit, so the method will fetch all messages.
This means :keyword:`await` may appear to hang if there are thousands of messages in the chat.
You can either set a smaller limit or use the ``async for`` syntax instead.
:param offset_id: :param offset_id:
Start getting messages with an identifier lower than this one. Start getting messages with an identifier lower than this one.
This means only messages older than the message with ``id = offset_id`` will be fetched. This means only messages older than the message with ``id = offset_id`` will be fetched.
@ -1291,6 +1297,10 @@ class Client:
:param limit: :param limit:
How many messages to fetch at most. How many messages to fetch at most.
.. note::
Like :meth:`get_messages`, there is no limit by default, so :keyword:`await` may appear to hang.
:param query: :param query:
Text query to use for fuzzy matching messages. Text query to use for fuzzy matching messages.
The rules for how "fuzzy" works are an implementation detail of the server. The rules for how "fuzzy" works are an implementation detail of the server.
@ -1335,6 +1345,10 @@ class Client:
:param limit: :param limit:
How many messages to fetch at most. How many messages to fetch at most.
.. note::
Like :meth:`get_messages`, there is no limit by default, so :keyword:`await` may appear to hang.
:param query: :param query:
Text query to use for fuzzy matching messages. Text query to use for fuzzy matching messages.
The rules for how "fuzzy" works are an implementation detail of the server. The rules for how "fuzzy" works are an implementation detail of the server.