mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-27 12:28:09 +00:00
Fix cross-reference links
This commit is contained in:
parent
29ac51f256
commit
0914654ba6
@ -23,7 +23,7 @@ Welcome to Pyrogram
|
|||||||
|
|
||||||
•
|
•
|
||||||
<a href="https://github.com/pyrogram/pyrogram/releases">
|
<a href="https://github.com/pyrogram/pyrogram/releases">
|
||||||
Changelog
|
Releases
|
||||||
</a>
|
</a>
|
||||||
•
|
•
|
||||||
<a href="https://pypi.org/project/Pyrogram">
|
<a href="https://pypi.org/project/Pyrogram">
|
||||||
@ -55,7 +55,7 @@ Welcome to Pyrogram
|
|||||||
app.run()
|
app.run()
|
||||||
|
|
||||||
**Pyrogram** is an elegant, easy-to-use Telegram_ client library and framework written from the ground up in Python and
|
**Pyrogram** is an elegant, easy-to-use Telegram_ client library and framework written from the ground up in Python and
|
||||||
C. It enables you to easily create custom apps using both user and bot identities (bot API alternative) via the
|
C. It enables you to easily create custom apps for both user and bot identities (bot API alternative) via the
|
||||||
`MTProto API`_.
|
`MTProto API`_.
|
||||||
|
|
||||||
.. _Telegram: https://telegram.org
|
.. _Telegram: https://telegram.org
|
||||||
@ -65,7 +65,8 @@ How the Documentation is Organized
|
|||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
Contents are organized into self-contained topics and can be all accessed from the sidebar, or by following them in
|
Contents are organized into self-contained topics and can be all accessed from the sidebar, or by following them in
|
||||||
order using the Next button at the end of each page. Here below you can find a list of the most relevant pages.
|
order using the Next button at the end of each page. Here below you can, instead, find a list of the most relevant
|
||||||
|
pages.
|
||||||
|
|
||||||
Getting Started
|
Getting Started
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
@ -86,9 +87,9 @@ API Reference
|
|||||||
- `Available Methods`_ - A list of available high-level methods.
|
- `Available Methods`_ - A list of available high-level methods.
|
||||||
- `Available Types`_ - A list of available high-level types.
|
- `Available Types`_ - A list of available high-level types.
|
||||||
|
|
||||||
.. _Client Class: core/client
|
.. _Client Class: api/client
|
||||||
.. _Available Methods: core/methods
|
.. _Available Methods: api/methods
|
||||||
.. _Available Types: core/types
|
.. _Available Types: api/types
|
||||||
|
|
||||||
Topics
|
Topics
|
||||||
^^^^^^
|
^^^^^^
|
||||||
|
@ -88,5 +88,5 @@ If no error shows up you are good to go.
|
|||||||
>>> pyrogram.__version__
|
>>> pyrogram.__version__
|
||||||
'0.12.0'
|
'0.12.0'
|
||||||
|
|
||||||
.. _TgCrypto: ../resources/tgcrypto.html
|
.. _TgCrypto: ../topics/tgcrypto
|
||||||
.. _`Github repo`: http://github.com/pyrogram/pyrogram
|
.. _`Github repo`: http://github.com/pyrogram/pyrogram
|
||||||
|
@ -4,18 +4,18 @@ Error Handling
|
|||||||
Errors are inevitable when working with the API, and they must be correctly handled with ``try..except`` blocks.
|
Errors are inevitable when working with the API, and they must be correctly handled with ``try..except`` blocks.
|
||||||
|
|
||||||
There are many errors that Telegram could return, but they all fall in one of these categories
|
There are many errors that Telegram could return, but they all fall in one of these categories
|
||||||
(which are in turn children of the :obj:`RPCError <pyrogram.RPCError>` superclass):
|
(which are in turn children of the ``RPCError`` superclass):
|
||||||
|
|
||||||
- :obj:`303 - See Other <pyrogram.errors.SeeOther>`
|
- `303 - See Other <../api/errors#see-other>`_
|
||||||
- :obj:`400 - Bad Request <pyrogram.errors.BadRequest>`
|
- `400 - Bad Request <../api/errors#bad-request>`_
|
||||||
- :obj:`401 - Unauthorized <pyrogram.errors.Unauthorized>`
|
- `401 - Unauthorized <../api/errors#unauthorized>`_
|
||||||
- :obj:`403 - Forbidden <pyrogram.errors.Forbidden>`
|
- `403 - Forbidden <../api/errors#forbidden>`_
|
||||||
- :obj:`406 - Not Acceptable <pyrogram.errors.NotAcceptable>`
|
- `406 - Not Acceptable <../api/errors#not-acceptable>`_
|
||||||
- :obj:`420 - Flood <pyrogram.errors.Flood>`
|
- `420 - Flood <../api/errors#flood>`_
|
||||||
- :obj:`500 - Internal Server Error <pyrogram.errors.InternalServerError>`
|
- `500 - Internal Server Error <../api/errors#internal-server-error>`_
|
||||||
|
|
||||||
As stated above, there are really many (too many) errors, and in case Pyrogram does not know anything yet about a
|
As stated above, there are really many (too many) errors, and in case Pyrogram does not know anything yet about a
|
||||||
specific one, it raises a special :obj:`520 Unknown Error <pyrogram.errors.UnknownError>` exception and logs it
|
specific one, it raises a special ``520 Unknown Error`` exception and logs it
|
||||||
in the ``unknown_errors.txt`` file. Users are invited to report these unknown errors.
|
in the ``unknown_errors.txt`` file. Users are invited to report these unknown errors.
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
@ -44,7 +44,7 @@ Examples
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
Exception objects may also contain some informative values.
|
Exception objects may also contain some informative values.
|
||||||
E.g.: :obj:`FloodWait <pyrogram.errors.exceptions.flood_420.FloodWait>` holds the amount of seconds you have to wait
|
E.g.: ``FloodWait`` holds the amount of seconds you have to wait
|
||||||
before you can try again. The value is always stored in the ``x`` field of the returned exception object:
|
before you can try again. The value is always stored in the ``x`` field of the returned exception object:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
@ -4,10 +4,13 @@ Handling Updates
|
|||||||
Calling `API methods`_ sequentially is cool, but how to react when, for example, a new message arrives? This page deals
|
Calling `API methods`_ sequentially is cool, but how to react when, for example, a new message arrives? This page deals
|
||||||
with updates and how to handle such events in Pyrogram. Let's have a look at how they work.
|
with updates and how to handle such events in Pyrogram. Let's have a look at how they work.
|
||||||
|
|
||||||
|
Defining Updates
|
||||||
|
----------------
|
||||||
|
|
||||||
First, let's define what are these updates. As hinted already, updates are simply events that happen in your Telegram
|
First, let's define what are these updates. As hinted already, updates are simply events that happen in your Telegram
|
||||||
account (incoming messages, new members join, button presses, etc...), which are meant to notify you about a new
|
account (incoming messages, new members join, button presses, etc...), which are meant to notify you about a new
|
||||||
specific state that changed. These updates are handled by registering one or more callback functions in your app using
|
specific state that changed. These updates are handled by registering one or more callback functions in your app using
|
||||||
`Handlers <../pyrogram/Handlers.html>`_.
|
`Handlers <../api/handlers>`_.
|
||||||
|
|
||||||
Each handler deals with a specific event and once a matching update arrives from Telegram, your registered callback
|
Each handler deals with a specific event and once a matching update arrives from Telegram, your registered callback
|
||||||
function will be called and its body executed.
|
function will be called and its body executed.
|
||||||
|
@ -125,12 +125,9 @@ For example, given the ID *123456789*, here's how Pyrogram can tell entities apa
|
|||||||
So, every time you take a raw ID, make sure to translate it into the correct ID when you want to use it with an
|
So, every time you take a raw ID, make sure to translate it into the correct ID when you want to use it with an
|
||||||
high-level method.
|
high-level method.
|
||||||
|
|
||||||
|
.. _methods: ../api/methods
|
||||||
|
.. _types: ../api/types
|
||||||
|
.. _plenty of them: ../api/methods
|
||||||
.. _methods: ../pyrogram/Client.html#messages
|
.. _raw functions: ../telegram/functions
|
||||||
.. _types: ../pyrogram/Types.html
|
.. _raw types: ../telegram/types
|
||||||
.. _plenty of them: ../pyrogram/Client.html#messages
|
|
||||||
.. _raw functions: ../pyrogram/functions
|
|
||||||
.. _raw types: ../pyrogram/types
|
|
||||||
.. _Community: https://t.me/PyrogramChat
|
.. _Community: https://t.me/PyrogramChat
|
@ -54,7 +54,7 @@ The ``[pyrogram]`` section contains your Telegram API credentials: *api_id* and
|
|||||||
api_id = 12345
|
api_id = 12345
|
||||||
api_hash = 0123456789abcdef0123456789abcdef
|
api_hash = 0123456789abcdef0123456789abcdef
|
||||||
|
|
||||||
`More info about API Key. <../start/Setup.html#configuration>`_
|
`More info about API Key. <../intro/setup#api-keys>`_
|
||||||
|
|
||||||
Proxy
|
Proxy
|
||||||
^^^^^
|
^^^^^
|
||||||
@ -70,7 +70,7 @@ The ``[proxy]`` section contains settings about your SOCKS5 proxy.
|
|||||||
username = <your_username>
|
username = <your_username>
|
||||||
password = <your_password>
|
password = <your_password>
|
||||||
|
|
||||||
`More info about SOCKS5 Proxy. <SOCKS5Proxy.html>`_
|
`More info about SOCKS5 Proxy. <proxy>`_
|
||||||
|
|
||||||
Plugins
|
Plugins
|
||||||
^^^^^^^
|
^^^^^^^
|
||||||
@ -87,4 +87,4 @@ The ``[plugins]`` section contains settings about Smart Plugins.
|
|||||||
exclude =
|
exclude =
|
||||||
module fn2
|
module fn2
|
||||||
|
|
||||||
`More info about Smart Plugins. <SmartPlugins.html>`_
|
`More info about Smart Plugins. <smart-plugins>`_
|
||||||
|
@ -11,7 +11,7 @@ What is Pyrogram?
|
|||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
**Pyrogram** is an elegant, easy-to-use Telegram_ client library and framework written from the ground up in Python and
|
**Pyrogram** is an elegant, easy-to-use Telegram_ client library and framework written from the ground up in Python and
|
||||||
C. It enables you to easily create custom applications using both user and bot identities (bot API alternative) via the
|
C. It enables you to easily create custom applications for both user and bot identities (bot API alternative) via the
|
||||||
`MTProto API`_ with the Python programming language.
|
`MTProto API`_ with the Python programming language.
|
||||||
|
|
||||||
.. _Telegram: https://telegram.org
|
.. _Telegram: https://telegram.org
|
||||||
@ -30,7 +30,7 @@ How old is Pyrogram?
|
|||||||
Pyrogram was first released on December 12, 2017. The actual work on the framework began roughly three months prior the
|
Pyrogram was first released on December 12, 2017. The actual work on the framework began roughly three months prior the
|
||||||
initial public release on `GitHub`_.
|
initial public release on `GitHub`_.
|
||||||
|
|
||||||
.. _GitHub: <https://github.com/pyrogram/pyrogram>
|
.. _GitHub: https://github.com/pyrogram/pyrogram
|
||||||
|
|
||||||
Why do I need an API key for bots?
|
Why do I need an API key for bots?
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
@ -218,5 +218,5 @@ The output of both (equivalent) examples will be:
|
|||||||
1
|
1
|
||||||
2
|
2
|
||||||
|
|
||||||
.. _`update handlers`: UpdateHandling.html
|
.. _`update handlers`: ../start/updates
|
||||||
.. _`filters`: UsingFilters.html
|
.. _`filters`: filters
|
@ -5,8 +5,8 @@ As you may probably know, Telegram allows users (and bots) having more than one
|
|||||||
in the system at the same time.
|
in the system at the same time.
|
||||||
|
|
||||||
Briefly explaining, sessions are simply new logins in your account. They can be reviewed in the settings of an official
|
Briefly explaining, sessions are simply new logins in your account. They can be reviewed in the settings of an official
|
||||||
app (or by invoking `GetAuthorizations <../functions/account/GetAuthorizations.html>`_ with Pyrogram). They store some
|
app (or by invoking `GetAuthorizations <../telegram/functions/account/GetAuthorizations.html>`_ with Pyrogram). They
|
||||||
useful information such as the client who's using them and from which country and IP address.
|
store some useful information such as the client who's using them and from which country and IP address.
|
||||||
|
|
||||||
.. figure:: https://i.imgur.com/lzGPCdZ.png
|
.. figure:: https://i.imgur.com/lzGPCdZ.png
|
||||||
:width: 70%
|
:width: 70%
|
||||||
|
@ -65,7 +65,7 @@ after importing your modules, like this:
|
|||||||
app.run()
|
app.run()
|
||||||
|
|
||||||
This is already nice and doesn't add *too much* boilerplate code, but things can get boring still; you have to
|
This is already nice and doesn't add *too much* boilerplate code, but things can get boring still; you have to
|
||||||
manually ``import``, manually :meth:`add_handler <pyrogram.Client.add_handler>` and manually instantiate each
|
manually ``import``, manually :meth:`add_handler() <pyrogram.Client.add_handler>` and manually instantiate each
|
||||||
:obj:`MessageHandler <pyrogram.MessageHandler>` object because **you can't use those cool decorators** for your
|
:obj:`MessageHandler <pyrogram.MessageHandler>` object because **you can't use those cool decorators** for your
|
||||||
functions. So, what if you could? Smart Plugins solve this issue by taking care of handlers registration automatically.
|
functions. So, what if you could? Smart Plugins solve this issue by taking care of handlers registration automatically.
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ found inside each module will be, instead, loaded in the order they are defined,
|
|||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Remember: there can be at most one handler, within a group, dealing with a specific update. Plugins with overlapping
|
Remember: there can be at most one handler, within a group, dealing with a specific update. Plugins with overlapping
|
||||||
filters included a second time will not work. Learn more at `More on Updates <MoreOnUpdates.html>`_.
|
filters included a second time will not work. Learn more at `More on Updates <more-on-updates>`_.
|
||||||
|
|
||||||
This default loading behaviour is usually enough, but sometimes you want to have more control on what to include (or
|
This default loading behaviour is usually enough, but sometimes you want to have more control on what to include (or
|
||||||
exclude) and in which exact order to load plugins. The way to do this is to make use of ``include`` and ``exclude``
|
exclude) and in which exact order to load plugins. The way to do this is to make use of ``include`` and ``exclude``
|
||||||
|
Loading…
x
Reference in New Issue
Block a user