diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index 347054ce..4b1d1767 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -498,7 +498,6 @@ def pyrogram_api(): Pyromod Identifier Listener - ListenerTypes """, bot_keyboards=""" Bot keyboards diff --git a/docs/source/api/enums/index.rst b/docs/source/api/enums/index.rst index d7e1401b..f98e3761 100644 --- a/docs/source/api/enums/index.rst +++ b/docs/source/api/enums/index.rst @@ -18,6 +18,7 @@ to apply only a valid value among the expected ones. ChatMemberStatus ChatMembersFilter ChatType + ListenerTypes MessageEntityType MessageMediaType MessageServiceType @@ -38,6 +39,7 @@ to apply only a valid value among the expected ones. ChatMemberStatus ChatMembersFilter ChatType + ListenerTypes MessageEntityType MessageMediaType MessageServiceType diff --git a/docs/source/index.rst b/docs/source/index.rst index 21c2ddf3..83d8c523 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -153,7 +153,6 @@ Meta faq/index support - releases/index .. toctree:: :hidden: diff --git a/docs/source/topics/storage-engines.rst b/docs/source/topics/storage-engines.rst index 8e7d3918..4b89e31e 100644 --- a/docs/source/topics/storage-engines.rst +++ b/docs/source/topics/storage-engines.rst @@ -68,21 +68,27 @@ In case you want to have persistent session but you don't have persistent storag mongodb config as ``dict`` to the ``mongodb`` parameter of the :obj:`~pyrogram.Client` constructor: Using async_pymongo (Recommended for python3.9+): + .. code-block:: python + from async_pymongo import AsyncClient from pyrogram import Client conn = AsyncClient("mongodb://...") + async with Client("my_account", mongodb=dict(connection=conn, remove_peers=False)) as app: print(await app.get_me()) Using motor: + .. code-block:: python + from motor.motor_asyncio import AsyncIOMotorClient from pyrogram import Client conn = AsyncIOMotorClient("mongodb://...") + async with Client("my_account", mongodb=dict(connection=conn, remove_peers=False)) as app: print(await app.get_me()) diff --git a/pyrogram/methods/pyromod/wait_for_callback_query.py b/pyrogram/methods/pyromod/wait_for_callback_query.py index 3fa7d94a..fd66da81 100644 --- a/pyrogram/methods/pyromod/wait_for_callback_query.py +++ b/pyrogram/methods/pyromod/wait_for_callback_query.py @@ -40,21 +40,29 @@ class WaitForCallbackQuery: Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. + filters (:obj:`Filters`): Pass one or more filters to allow only a subset of callback queries to be passed in your callback function. + timeout (``int``, *optional*): Timeout in seconds. + Returns: :obj:`~pyrogram.types.CallbackQuery`: On success, the callback query is returned. + Raises: asyncio.TimeoutError: In case callback query not received within the timeout. + Example: .. code-block:: python + # Simple example callback_query = app.wait_for_callback_query(chat_id) + # Example with filter callback_query = app.wait_for_callback_query(chat_id, filters=filters.user(user_id)) + # Example with timeout callback_query = app.wait_for_callback_query(chat_id, timeout=60) """ @@ -73,4 +81,4 @@ class WaitForCallbackQuery: ) waiter = dict(future=future, filters=filters, update_type=types.CallbackQuery) conversation_handler.waiters[chat_id] = waiter - return await asyncio.wait_for(future, timeout=timeout) \ No newline at end of file + return await asyncio.wait_for(future, timeout=timeout) diff --git a/pyrogram/methods/pyromod/wait_for_message.py b/pyrogram/methods/pyromod/wait_for_message.py index 3a814e38..d2c93285 100644 --- a/pyrogram/methods/pyromod/wait_for_message.py +++ b/pyrogram/methods/pyromod/wait_for_message.py @@ -39,21 +39,29 @@ class WaitForMessage: Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. + filters (:obj:`Filters`): Pass one or more filters to allow only a subset of callback queries to be passed in your callback function. + timeout (``int``, *optional*): Timeout in seconds. + Returns: :obj:`~pyrogram.types.Message`: On success, the reply message is returned. + Raises: asyncio.TimeoutError: In case message not received within the timeout. + Example: .. code-block:: python + # Simple example reply_message = app.wait_for_message(chat_id) + # Example with filter reply_message = app.wait_for_message(chat_id, filters=filters.text) + # Example with timeout reply_message = app.wait_for_message(chat_id, timeout=60) """