From c9006024e2f458c0a517f75fc263996333462704 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Wed, 3 Apr 2024 16:49:47 +0200 Subject: [PATCH] Document get_messages has no default limit --- client/doc/developing/faq.rst | 2 +- client/src/telethon/_impl/client/client/client.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client/doc/developing/faq.rst b/client/doc/developing/faq.rst index 1393e74b..3945add3 100644 --- a/client/doc/developing/faq.rst +++ b/client/doc/developing/faq.rst @@ -93,7 +93,7 @@ For more information, see the :doc:`/concepts/datacenters` concept. 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 diff --git a/client/src/telethon/_impl/client/client/client.py b/client/src/telethon/_impl/client/client/client.py index 5a45f9e0..38c68f86 100644 --- a/client/src/telethon/_impl/client/client/client.py +++ b/client/src/telethon/_impl/client/client/client.py @@ -825,6 +825,12 @@ class Client: :param limit: 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: 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. @@ -1291,6 +1297,10 @@ class Client: :param limit: 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: Text query to use for fuzzy matching messages. The rules for how "fuzzy" works are an implementation detail of the server. @@ -1335,6 +1345,10 @@ class Client: :param limit: 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: Text query to use for fuzzy matching messages. The rules for how "fuzzy" works are an implementation detail of the server.