Skip to content

Commit

Permalink
Pyrofork: Fix docs
Browse files Browse the repository at this point in the history
Signed-off-by: wulan17 <[email protected]>
  • Loading branch information
wulan17 committed Dec 14, 2023
1 parent 9ee3afb commit 1906bc2
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 3 deletions.
1 change: 0 additions & 1 deletion compiler/docs/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ def get_title_list(s: str) -> list:
Pyromod
Identifier
Listener
ListenerTypes
""",
bot_keyboards="""
Bot keyboards
Expand Down
2 changes: 2 additions & 0 deletions docs/source/api/enums/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ to apply only a valid value among the expected ones.
ChatMemberStatus
ChatMembersFilter
ChatType
ListenerTypes
MessageEntityType
MessageMediaType
MessageServiceType
Expand All @@ -38,6 +39,7 @@ to apply only a valid value among the expected ones.
ChatMemberStatus
ChatMembersFilter
ChatType
ListenerTypes
MessageEntityType
MessageMediaType
MessageServiceType
Expand Down
1 change: 0 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ Meta

faq/index
support
releases/index

.. toctree::
:hidden:
Expand Down
6 changes: 6 additions & 0 deletions docs/source/topics/storage-engines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
10 changes: 9 additions & 1 deletion pyrogram/methods/pyromod/wait_for_callback_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,29 @@ async def wait_for_callback_query(
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)
"""
Expand All @@ -73,4 +81,4 @@ async def wait_for_callback_query(
)
waiter = dict(future=future, filters=filters, update_type=types.CallbackQuery)
conversation_handler.waiters[chat_id] = waiter
return await asyncio.wait_for(future, timeout=timeout)
return await asyncio.wait_for(future, timeout=timeout)
8 changes: 8 additions & 0 deletions pyrogram/methods/pyromod/wait_for_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,29 @@ async def wait_for_message(
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)
"""
Expand Down

0 comments on commit 1906bc2

Please sign in to comment.