2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-31 06:16:06 +00:00

Move single methods, types and bound-methods to separated pages

The resulting pages were huge and were also taking a while to load
This will improve docs navigation
This commit is contained in:
Dan
2019-07-09 19:03:46 +02:00
parent ee2d5b1315
commit efcf7d5503
9 changed files with 662 additions and 637 deletions

View File

@@ -0,0 +1,88 @@
Bound Methods
=============
Some Pyrogram types define what are called bound methods. Bound methods are functions attached to a class which are
accessed via an instance of that class. They make it even easier to call specific methods by automatically inferring
some of the required arguments.
.. code-block:: python
:emphasize-lines: 8
from pyrogram import Client
app = Client("my_account")
@app.on_message()
def hello(client, message)
message.reply("hi")
app.run()
.. currentmodule:: pyrogram
Message
-------
.. hlist::
:columns: 3
{message_hlist}
.. toctree::
:hidden:
{message_toctree}
Chat
----
.. hlist::
:columns: 4
{chat_hlist}
.. toctree::
:hidden:
{chat_toctree}
User
----
.. hlist::
:columns: 2
{user_hlist}
.. toctree::
:hidden:
{user_toctree}
CallbackQuery
-------------
.. hlist::
:columns: 3
{callback_query_hlist}
.. toctree::
:hidden:
{callback_query_toctree}
InlineQuery
-----------
.. hlist::
:columns: 2
{inline_query_hlist}
.. toctree::
:hidden:
{inline_query_toctree}

122
compiler/docs/template/methods.rst vendored Normal file
View File

@@ -0,0 +1,122 @@
Available Methods
=================
This page is about Pyrogram methods. All the methods listed here are bound to a :class:`~pyrogram.Client` instance.
.. code-block:: python
:emphasize-lines: 6
from pyrogram import Client
app = Client("my_account")
with app:
app.send_message("haskell", "hi")
.. currentmodule:: pyrogram.Client
Utilities
---------
.. autosummary::
:nosignatures:
{utilities}
.. toctree::
:hidden:
{utilities}
Messages
--------
.. autosummary::
:nosignatures:
{messages}
.. toctree::
:hidden:
{messages}
Chats
-----
.. autosummary::
:nosignatures:
{chats}
.. toctree::
:hidden:
{chats}
Users
-----
.. autosummary::
:nosignatures:
{users}
.. toctree::
:hidden:
{users}
Contacts
--------
.. autosummary::
:nosignatures:
{contacts}
.. toctree::
:hidden:
{contacts}
Password
--------
.. autosummary::
:nosignatures:
{password}
.. toctree::
:hidden:
{password}
Bots
----
.. autosummary::
:nosignatures:
{bots}
.. toctree::
:hidden:
{bots}
Advanced
--------
Learn more about these methods at :doc:`Advanced Usage <../../topics/advanced-usage>`.
.. autosummary::
:nosignatures:
{advanced}
.. toctree::
:hidden:
{advanced}

95
compiler/docs/template/types.rst vendored Normal file
View File

@@ -0,0 +1,95 @@
Available Types
===============
This page is about Pyrogram types. All types listed here are accessible through the main package directly.
.. code-block:: python
:emphasize-lines: 1
from pyrogram import User, Message, ...
.. note::
**Optional** fields may not exist when irrelevant -- i.e.: they will contain the value of ``None`` and aren't shown
when, for example, using ``print()``.
.. currentmodule:: pyrogram
Users & Chats
-------------
.. autosummary::
:nosignatures:
{users_chats}
.. toctree::
:hidden:
{users_chats}
Messages & Media
----------------
.. autosummary::
:nosignatures:
{messages_media}
.. toctree::
:hidden:
{messages_media}
Bots & Keyboards
----------------
.. autosummary::
:nosignatures:
{bots_keyboard}
.. toctree::
:hidden:
{bots_keyboard}
Input Media
-----------
.. autosummary::
:nosignatures:
{input_media}
.. toctree::
:hidden:
{input_media}
Inline Mode
-----------
.. autosummary::
:nosignatures:
{inline_mode}
.. toctree::
:hidden:
{inline_mode}
InputMessageContent
-------------------
.. autosummary::
:nosignatures:
{input_message_content}
.. toctree::
:hidden:
{input_message_content}