mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-01 21:24:50 +00:00
PyroFork: Rebrand docs
Signed-off-by: wulan17 <galihgustip@gmail.com>
This commit is contained in:
parent
41b771f4bf
commit
bec44280a4
42 changed files with 140 additions and 179 deletions
|
|
@ -1,7 +1,7 @@
|
|||
Pyrogram Client
|
||||
PyroFork Client
|
||||
===============
|
||||
|
||||
You have entered the API Reference section where you can find detailed information about Pyrogram's API. The main Client
|
||||
You have entered the API Reference section where you can find detailed information about PyroFork's API. The main Client
|
||||
class, all available methods and types, filters, handlers, decorators and bound-methods detailed descriptions can be
|
||||
found starting from this page.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Enumerations
|
||||
============
|
||||
|
||||
This page is about Pyrogram enumerations.
|
||||
This page is about PyroFork enumerations.
|
||||
Enumerations are types that hold a group of related values to be used whenever a constant value is required.
|
||||
They will help you deal with those values in a type-safe way and also enable code completion so that you can be sure
|
||||
to apply only a valid value among the expected ones.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
RPC Errors
|
||||
==========
|
||||
|
||||
All Pyrogram API errors live inside the ``errors`` sub-package: ``pyrogram.errors``.
|
||||
The errors ids listed here are shown as *UPPER_SNAKE_CASE*, but the actual exception names to import from Pyrogram
|
||||
All PyroFork API errors live inside the ``errors`` sub-package: ``pyrogram.errors``.
|
||||
The errors ids listed here are shown as *UPPER_SNAKE_CASE*, but the actual exception names to import from PyroFork
|
||||
follow the usual *PascalCase* convention.
|
||||
|
||||
.. code-block:: python
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Update Handlers
|
||||
===============
|
||||
|
||||
Handlers are used to instruct Pyrogram about which kind of updates you'd like to handle with your callback functions.
|
||||
Handlers are used to instruct PyroFork about which kind of updates you'd like to handle with your callback functions.
|
||||
For a much more convenient way of registering callback functions have a look at :doc:`Decorators <decorators>` instead.
|
||||
|
||||
.. code-block:: python
|
||||
|
|
|
|||
|
|
@ -1,20 +1,21 @@
|
|||
# Pyrogram - Telegram MTProto API Client Library for Python
|
||||
# PyroFork - Telegram MTProto API Client Library for Python
|
||||
# Copyright (C) 2017-present Dan <https://github.com/delivrance>
|
||||
# Copyright (C) 2022-present wulan17 <https://github.com/wulan17>
|
||||
#
|
||||
# This file is part of Pyrogram.
|
||||
# This file is part of PyroFork.
|
||||
#
|
||||
# Pyrogram is free software: you can redistribute it and/or modify
|
||||
# PyroFork is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Pyrogram is distributed in the hope that it will be useful,
|
||||
# PyroFork is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with PyroFork. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
|
@ -27,9 +28,9 @@ from pygments.styles.friendly import FriendlyStyle
|
|||
|
||||
FriendlyStyle.background_color = "#f3f2f1"
|
||||
|
||||
project = "Pyrogram"
|
||||
copyright = f"2017-present, Dan"
|
||||
author = "Dan"
|
||||
project = "PyroFork"
|
||||
copyright = f"2022-present, wulan17"
|
||||
author = "wulan17"
|
||||
|
||||
version = ".".join(__version__.split(".")[:-1])
|
||||
|
||||
|
|
@ -61,7 +62,7 @@ copybutton_prompt_text = "$ "
|
|||
|
||||
suppress_warnings = ["image.not_readable"]
|
||||
|
||||
html_title = "Pyrogram Documentation"
|
||||
html_title = "PyroFork Documentation"
|
||||
html_theme = "sphinx_rtd_theme"
|
||||
html_static_path = ["../resources/static"]
|
||||
html_show_sourcelink = True
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ Code hangs when calling stop, restart, add/remove_handler
|
|||
=========================================================
|
||||
|
||||
You tried to ``.stop()``, ``.restart()``, ``.add_handler()`` or ``.remove_handler()`` inside a running handler, but
|
||||
that can't be done because the way Pyrogram deals with handlers would make it hang.
|
||||
that can't be done because the way PyroFork deals with handlers would make it hang.
|
||||
|
||||
When calling one of the methods above inside an event handler, Pyrogram needs to wait for all running handlers to finish
|
||||
When calling one of the methods above inside an event handler, PyroFork needs to wait for all running handlers to finish
|
||||
in order to continue. Since your handler is blocking the execution by waiting for the called method to finish
|
||||
and since Pyrogram needs to wait for your handler to finish, you are left with a deadlock.
|
||||
and since PyroFork needs to wait for your handler to finish, you are left with a deadlock.
|
||||
|
||||
The solution to this problem is to pass ``block=False`` to such methods so that they return immediately and the actual
|
||||
code called asynchronously.
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
How to use webhooks?
|
||||
====================
|
||||
|
||||
There is no webhook in Pyrogram, simply because there is no HTTP involved. However, a similar technique is
|
||||
There is no webhook in PyroFork, simply because there is no HTTP involved. However, a similar technique is
|
||||
being used to make receiving updates efficient.
|
||||
|
||||
Pyrogram uses persistent connections via TCP sockets to interact with the server and instead of actively asking for
|
||||
updates every time (polling), Pyrogram will sit down and wait for the server to send updates by itself the very moment
|
||||
PyroFork uses persistent connections via TCP sockets to interact with the server and instead of actively asking for
|
||||
updates every time (polling), PyroFork will sit down and wait for the server to send updates by itself the very moment
|
||||
they are available (server push).
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Frequently Asked Questions
|
||||
==========================
|
||||
|
||||
This FAQ page provides answers to common questions about Pyrogram and, to some extent, Telegram in general.
|
||||
This FAQ page provides answers to common questions about PyroFork and, to some extent, Telegram in general.
|
||||
|
||||
**Contents**
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ This error could mean several things:
|
|||
- The chat id refers to a user or chat your current session hasn't met yet.
|
||||
|
||||
About the last point: in order for you to meet a user and thus communicate with them, you should ask yourself how to
|
||||
contact people using official apps. The answer is the same for Pyrogram too and involves normal usages such as searching
|
||||
contact people using official apps. The answer is the same for PyroFork too and involves normal usages such as searching
|
||||
for usernames, meeting them in a common group, having their phone contacts saved, getting a message mentioning them
|
||||
or obtaining the dialogs list.
|
||||
|
|
@ -6,7 +6,7 @@ Another reason could be because you are blocking the event loop for too long.
|
|||
|
||||
You can consider the following:
|
||||
|
||||
- Use Pyrogram asynchronously in its intended way.
|
||||
- Use PyroFork asynchronously in its intended way.
|
||||
- Use shorter non-asynchronous processing loops.
|
||||
- Use ``asyncio.sleep()`` instead of ``time.sleep()``.
|
||||
- Use a stable network connection.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
The account has been limited/deactivated
|
||||
========================================
|
||||
|
||||
Pyrogram is a framework that interfaces with Telegram; it is at your commands, meaning it only does what you tell it to
|
||||
PyroFork is a framework that interfaces with Telegram; it is at your commands, meaning it only does what you tell it to
|
||||
do, the rest is up to you and Telegram (see `Telegram's ToS`_).
|
||||
|
||||
If you found your account being limited/deactivated, it could be due spam/flood/abuse of the API or the usage of certain
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@ UnicodeEncodeError: '...' codec can't encode ...
|
|||
================================================
|
||||
|
||||
Where ``<encoding>`` might be *ascii*, *cp932*, *charmap* or anything else other than *utf-8*. This error usually
|
||||
shows up when you try to print something and has very little to do with Pyrogram itself as it is strictly related to
|
||||
shows up when you try to print something and has very little to do with PyroFork itself as it is strictly related to
|
||||
your own terminal. To fix it, either find a way to change the encoding settings of your terminal to UTF-8 or switch to
|
||||
another terminal altogether.
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
Welcome to Pyrogram
|
||||
Welcome to PyroFork
|
||||
===================
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<a href="/">
|
||||
<div class="pyrogram-logo-index"><img src="_static/pyrogram.png" alt="Pyrogram"></div>
|
||||
<div class="pyrogram-text pyrogram-text-index">Pyrogram</div>
|
||||
<div class="pyrogram-logo-index"><img src="_static/pyrogram.png" alt="PyroFork"></div>
|
||||
<div class="pyrogram-text pyrogram-text-index">PyroFork</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
|
@ -40,19 +40,19 @@ Welcome to Pyrogram
|
|||
|
||||
@app.on_message(filters.private)
|
||||
async def hello(client, message):
|
||||
await message.reply("Hello from Pyrogram!")
|
||||
await message.reply("Hello from PyroFork!")
|
||||
|
||||
|
||||
app.run()
|
||||
|
||||
**Pyrogram** is a modern, elegant and asynchronous :doc:`MTProto API <topics/mtproto-vs-botapi>` framework.
|
||||
**PyroFork** is a modern, elegant and asynchronous :doc:`MTProto API <topics/mtproto-vs-botapi>` framework.
|
||||
It enables you to easily interact with the main Telegram API through a user account (custom client) or a bot identity
|
||||
(bot API alternative) using Python.
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
If you'd like to support Pyrogram, you can consider:
|
||||
If you'd like to support PyroFork, you can consider:
|
||||
|
||||
- `Become a GitHub sponsor <https://github.com/sponsors/delivrance>`_.
|
||||
- `Become a LiberaPay patron <https://liberapay.com/delivrance>`_.
|
||||
|
|
@ -75,7 +75,7 @@ First Steps
|
|||
:columns: 1
|
||||
|
||||
- :doc:`Quick Start <intro/quickstart>`: Overview to get you started quickly.
|
||||
- :doc:`Invoking Methods <start/invoking>`: How to call Pyrogram's methods.
|
||||
- :doc:`Invoking Methods <start/invoking>`: How to call PyroFork's methods.
|
||||
- :doc:`Handling Updates <start/updates>`: How to handle Telegram updates.
|
||||
- :doc:`Error Handling <start/errors>`: How to handle API errors correctly.
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ API Reference
|
|||
.. hlist::
|
||||
:columns: 1
|
||||
|
||||
- :doc:`Pyrogram Client <api/client>`: Reference details about the Client class.
|
||||
- :doc:`PyroFork Client <api/client>`: Reference details about the Client class.
|
||||
- :doc:`Available Methods <api/methods/index>`: List of available high-level methods.
|
||||
- :doc:`Available Types <api/types/index>`: List of available high-level types.
|
||||
- :doc:`Enumerations <api/enums/index>`: List of available enumerations.
|
||||
|
|
@ -97,9 +97,9 @@ Meta
|
|||
.. hlist::
|
||||
:columns: 1
|
||||
|
||||
- :doc:`Pyrogram FAQ <faq/index>`: Answers to common Pyrogram questions.
|
||||
- :doc:`Support Pyrogram <support>`: Ways to show your appreciation.
|
||||
- :doc:`Release Notes <releases/index>`: Release notes for Pyrogram releases.
|
||||
- :doc:`PyroFork FAQ <faq/index>`: Answers to common PyroFork questions.
|
||||
- :doc:`Support PyroFork <support>`: Ways to show your appreciation.
|
||||
- :doc:`Release Notes <releases/index>`: Release notes for PyroFork releases.
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Install Guide
|
||||
=============
|
||||
|
||||
Being a modern Python framework, Pyrogram requires an up to date version of Python to be installed in your system.
|
||||
Being a modern Python framework, PyroFork requires an up to date version of Python to be installed in your system.
|
||||
We recommend using the latest versions of both Python 3 and pip.
|
||||
|
||||
.. contents:: Contents
|
||||
|
|
@ -11,34 +11,25 @@ We recommend using the latest versions of both Python 3 and pip.
|
|||
|
||||
-----
|
||||
|
||||
Install Pyrogram
|
||||
Install PyroFork
|
||||
----------------
|
||||
|
||||
- The easiest way to install and upgrade Pyrogram to its latest stable version is by using **pip**:
|
||||
- The easiest way to install and upgrade PyroFork to its latest stable version is by using **pip**:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ pip3 install -U pyrogram
|
||||
$ pip3 install -U git+https://github.com/Mayuri-Chan/pyrofork@dev/pyrofork
|
||||
|
||||
- or, with :doc:`TgCrypto <../topics/speedups>` as extra requirement (recommended):
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ pip3 install -U pyrogram tgcrypto
|
||||
|
||||
Bleeding Edge
|
||||
-------------
|
||||
|
||||
You can install the development version from the git ``master`` branch using this command:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip
|
||||
$ pip3 install -U git+https://github.com/Mayuri-Chan/pyrofork@dev/pyrofork tgcrypto
|
||||
|
||||
Verifying
|
||||
---------
|
||||
|
||||
To verify that Pyrogram is correctly installed, open a Python shell and import it.
|
||||
To verify that PyroFork is correctly installed, open a Python shell and import it.
|
||||
If no error shows up you are good to go.
|
||||
|
||||
.. parsed-literal::
|
||||
|
|
@ -47,4 +38,4 @@ If no error shows up you are good to go.
|
|||
>>> pyrogram.__version__
|
||||
'x.y.z'
|
||||
|
||||
.. _`Github repo`: http://github.com/pyrogram/pyrogram
|
||||
.. _`Github repo`: https://github.com/Mayuri-Chan/pyrofork
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
Quick Start
|
||||
===========
|
||||
|
||||
The next few steps serve as a quick start to see Pyrogram in action as fast as possible.
|
||||
The next few steps serve as a quick start to see PyroFork in action as fast as possible.
|
||||
|
||||
Get Pyrogram Real Fast
|
||||
Get PyroFork Real Fast
|
||||
----------------------
|
||||
|
||||
.. admonition :: Cloud Credits
|
||||
|
|
@ -12,7 +12,7 @@ Get Pyrogram Real Fast
|
|||
If you need a cloud server to host your applications, try Hetzner Cloud. You can sign up with
|
||||
`this link <https://hetzner.cloud/?ref=9CyT92gZEINU>`_ to get €20 in cloud credits.
|
||||
|
||||
1. Install Pyrogram with ``pip3 install -U pyrogram``.
|
||||
1. Install PyroFork with ``pip3 install -U pyrogram``.
|
||||
|
||||
2. Get your own Telegram API key from https://my.telegram.org/apps.
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ Get Pyrogram Real Fast
|
|||
|
||||
async def main():
|
||||
async with Client("my_account", api_id, api_hash) as app:
|
||||
await app.send_message("me", "Greetings from **Pyrogram**!")
|
||||
await app.send_message("me", "Greetings from **PyroFork**!")
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
|
|
@ -42,7 +42,7 @@ Get Pyrogram Real Fast
|
|||
|
||||
7. Follow the instructions on your terminal to login.
|
||||
|
||||
8. Watch Pyrogram send a message to yourself.
|
||||
8. Watch PyroFork send a message to yourself.
|
||||
|
||||
Enjoy the API
|
||||
-------------
|
||||
|
|
@ -53,4 +53,4 @@ we have just done above.
|
|||
If you are feeling eager to continue you can take a shortcut to :doc:`../start/invoking` and come back
|
||||
later to learn some more details.
|
||||
|
||||
.. _community: https://t.me/Pyrogram
|
||||
.. _community: https://t.me/PyroFork
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Authorization
|
||||
=============
|
||||
|
||||
Once a :doc:`project is set up <setup>`, you will still have to follow a few steps before you can actually use Pyrogram to make
|
||||
Once a :doc:`project is set up <setup>`, you will still have to follow a few steps before you can actually use PyroFork to make
|
||||
API calls. This section provides all the information you need in order to authorize yourself as user or bot.
|
||||
|
||||
.. contents:: Contents
|
||||
|
|
@ -15,7 +15,7 @@ User Authorization
|
|||
------------------
|
||||
|
||||
In order to use the API, Telegram requires that users be authorized via their phone numbers.
|
||||
Pyrogram automatically manages this process, all you need to do is create an instance of the
|
||||
PyroFork automatically manages this process, all you need to do is create an instance of the
|
||||
:class:`~pyrogram.Client` class by passing to it a ``name`` of your choice (e.g.: "my_account") and call
|
||||
the :meth:`~pyrogram.Client.run` method:
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ authorized or via SMS:
|
|||
Enter phone code: 12345
|
||||
Logged in successfully
|
||||
|
||||
After successfully authorizing yourself, a new file called ``my_account.session`` will be created allowing Pyrogram to
|
||||
After successfully authorizing yourself, a new file called ``my_account.session`` will be created allowing PyroFork to
|
||||
execute API calls with your identity. This file is personal and will be loaded again when you restart your app.
|
||||
You can now remove the api_id and api_hash values from the code as they are not needed anymore.
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ Bot Authorization
|
|||
|
||||
Bots are a special kind of users that are authorized via their tokens (instead of phone numbers), which are created by
|
||||
the `Bot Father`_. Bot tokens replace the users' phone numbers only — you still need to
|
||||
:doc:`configure a Telegram API key <../start/setup>` with Pyrogram, even when using bots.
|
||||
:doc:`configure a Telegram API key <../start/setup>` with PyroFork, even when using bots.
|
||||
|
||||
The authorization process is automatically managed. All you need to do is choose a ``name`` (can be anything,
|
||||
usually your bot username) and pass your bot token using the ``bot_token`` parameter. The session file will be named
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ Error Handling
|
|||
==============
|
||||
|
||||
Errors can be correctly handled with ``try...except`` blocks in order to control the behaviour of your application.
|
||||
Pyrogram errors all live inside the ``errors`` package:
|
||||
PyroFork errors all live inside the ``errors`` package:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ This error is raised every time a method call against Telegram's API was unsucce
|
|||
Error Categories
|
||||
----------------
|
||||
|
||||
The ``RPCError`` packs together all the possible errors Telegram could raise, but to make things tidier, Pyrogram
|
||||
The ``RPCError`` packs together all the possible errors Telegram could raise, but to make things tidier, PyroFork
|
||||
provides categories of errors, which are named after the common HTTP errors and are subclass-ed from the ``RPCError``:
|
||||
|
||||
.. code-block:: python
|
||||
|
|
@ -51,7 +51,7 @@ provides categories of errors, which are named after the common HTTP errors and
|
|||
Single Errors
|
||||
-------------
|
||||
|
||||
For a fine-grained control over every single error, Pyrogram does also expose errors that deal each with a specific
|
||||
For a fine-grained control over every single error, PyroFork does also expose errors that deal each with a specific
|
||||
issue. For example:
|
||||
|
||||
.. code-block:: python
|
||||
|
|
@ -77,7 +77,7 @@ These errors subclass directly from the category of errors they belong to, which
|
|||
Unknown Errors
|
||||
--------------
|
||||
|
||||
In case Pyrogram does not know anything about a specific error yet, it raises a generic error from its known category,
|
||||
In case PyroFork does not know anything about a specific error yet, it raises a generic error from its known category,
|
||||
for example, an unknown error with error code ``400``, will be raised as a ``BadRequest``. This way you can catch the
|
||||
whole category of errors and be sure to also handle these unknown errors.
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ This example demonstrates a basic API usage
|
|||
async def main():
|
||||
async with app:
|
||||
# Send a message, Markdown is enabled by default
|
||||
await app.send_message("me", "Hi there! I'm using **Pyrogram**")
|
||||
await app.send_message("me", "Hi there! I'm using **PyroFork**")
|
||||
|
||||
|
||||
app.run(main())
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Examples
|
||||
========
|
||||
|
||||
This page contains example scripts to show you how Pyrogram looks like.
|
||||
This page contains example scripts to show you how PyroFork looks like.
|
||||
|
||||
Every script is working right away (provided you correctly set up your credentials), meaning you can simply copy-paste
|
||||
and run. The only things you have to change are session names and target chats, where applicable.
|
||||
|
|
@ -18,7 +18,7 @@ to give you a basic idea.
|
|||
|
||||
:doc:`hello_world`, "Demonstration of basic API usage"
|
||||
:doc:`echo_bot`, "Echo every private text message"
|
||||
:doc:`welcome_bot`, "The Welcome Bot in @PyrogramChat"
|
||||
:doc:`welcome_bot`, "The Welcome Bot in @PyroForkChat"
|
||||
:doc:`get_chat_history`, "Get the full message history of a chat"
|
||||
:doc:`get_chat_members`, "Get all the members of a chat"
|
||||
:doc:`get_dialogs`, "Get all of your dialog chats"
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ It uses the @on_inline_query decorator to register an InlineQueryHandler.
|
|||
InlineQueryResultArticle(
|
||||
title="Installation",
|
||||
input_message_content=InputTextMessageContent(
|
||||
"Here's how to install **Pyrogram**"
|
||||
"Here's how to install **PyroFork**"
|
||||
),
|
||||
url="https://docs.pyrogram.org/intro/install",
|
||||
description="How to install Pyrogram",
|
||||
description="How to install PyroFork",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[
|
||||
[InlineKeyboardButton(
|
||||
|
|
@ -38,10 +38,10 @@ It uses the @on_inline_query decorator to register an InlineQueryHandler.
|
|||
InlineQueryResultArticle(
|
||||
title="Usage",
|
||||
input_message_content=InputTextMessageContent(
|
||||
"Here's how to use **Pyrogram**"
|
||||
"Here's how to use **PyroFork**"
|
||||
),
|
||||
url="https://docs.pyrogram.org/start/invoking",
|
||||
description="How to use Pyrogram",
|
||||
description="How to use PyroFork",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[
|
||||
[InlineKeyboardButton(
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ to make it only work for specific messages in a specific chat.
|
|||
# Target chat. Can also be a list of multiple chat ids/usernames
|
||||
TARGET = -100123456789
|
||||
# Welcome message template
|
||||
MESSAGE = "{} Welcome to [Pyrogram](https://docs.pyrogram.org/)'s group chat {}!"
|
||||
MESSAGE = "{} Welcome to [PyroFork](https://docs.pyrogram.org/)'s group chat {}!"
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Invoking Methods
|
||||
================
|
||||
|
||||
At this point, we have successfully :doc:`installed Pyrogram <../intro/install>` and :doc:`authorized <auth>` our
|
||||
At this point, we have successfully :doc:`installed PyroFork <../intro/install>` and :doc:`authorized <auth>` our
|
||||
account; we are now aiming towards the core of the framework.
|
||||
|
||||
.. contents:: Contents
|
||||
|
|
@ -14,7 +14,7 @@ account; we are now aiming towards the core of the framework.
|
|||
Basic Usage
|
||||
-----------
|
||||
|
||||
Making API calls with Pyrogram is very simple. Here's a basic example we are going to examine step by step:
|
||||
Making API calls with PyroFork is very simple. Here's a basic example we are going to examine step by step:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ Step-by-step
|
|||
async with app:
|
||||
await app.send_message("me", "Hi!")
|
||||
|
||||
#. Finally, we tell Python to schedule our ``main()`` async function by using Pyrogram's :meth:`~pyrogram.Client.run`
|
||||
#. Finally, we tell Python to schedule our ``main()`` async function by using PyroFork's :meth:`~pyrogram.Client.run`
|
||||
method.
|
||||
|
||||
.. code-block:: python
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Project Setup
|
||||
=============
|
||||
|
||||
We have just :doc:`installed Pyrogram <../intro/install>`. In this page we'll discuss what you need to do in order to set up a
|
||||
We have just :doc:`installed PyroFork <../intro/install>`. In this page we'll discuss what you need to do in order to set up a
|
||||
project with the framework.
|
||||
|
||||
.. contents:: Contents
|
||||
|
|
@ -28,7 +28,7 @@ The first step requires you to obtain a valid Telegram API key (api_id and api_h
|
|||
Configuration
|
||||
-------------
|
||||
|
||||
Having the API key from the previous step in handy, we can now begin to configure a Pyrogram project: pass your API key to Pyrogram by using the *api_id* and *api_hash* parameters of the Client class:
|
||||
Having the API key from the previous step in handy, we can now begin to configure a PyroFork project: pass your API key to PyroFork by using the *api_id* and *api_hash* parameters of the Client class:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
Handling Updates
|
||||
================
|
||||
|
||||
:doc:`Invoking API methods <invoking>` sequentially is one way to use Pyrogram. This page deals with Telegram updates
|
||||
and how to handle new incoming messages or other events in Pyrogram.
|
||||
:doc:`Invoking API methods <invoking>` sequentially is one way to use PyroFork. This page deals with Telegram updates
|
||||
and how to handle new incoming messages or other events in PyroFork.
|
||||
|
||||
.. contents:: Contents
|
||||
:backlinks: none
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Support Pyrogram
|
||||
Support PyroFork
|
||||
================
|
||||
|
||||
.. raw:: html
|
||||
|
|
@ -7,13 +7,13 @@ Support Pyrogram
|
|||
|
||||
<div style="float: right; margin-bottom: 10px">
|
||||
<a class="github-button"
|
||||
href="https://github.com/pyrogram/pyrogram"
|
||||
href="https://github.com/Mayuri-Chan/pyrofork"
|
||||
data-color-scheme="no-preference: light; light: light; dark: dark;"
|
||||
data-icon="octicon-star" data-size="large" data-show-count="true"
|
||||
aria-label="Star pyrogram/pyrogram on GitHub">Star</a>
|
||||
|
||||
<a class="github-button"
|
||||
href="https://github.com/pyrogram/pyrogram/fork"
|
||||
href="https://github.com/Mayuri-Chan/pyrofork/fork"
|
||||
data-color-scheme="no-preference: light; light: light; dark: dark;"
|
||||
data-icon="octicon-repo-forked" data-size="large"
|
||||
data-show-count="true" aria-label="Fork pyrogram/pyrogram on GitHub">Fork</a>
|
||||
|
|
@ -21,43 +21,12 @@ Support Pyrogram
|
|||
|
||||
<br style="clear: both"/>
|
||||
|
||||
Pyrogram is a free and open source project.
|
||||
If you enjoy Pyrogram and would like to show your appreciation, consider donating or becoming
|
||||
a sponsor of the project. You can support Pyrogram via the ways shown below:
|
||||
PyroFork is a free and open source project.
|
||||
If you enjoy PyroFork and would like to show your appreciation, consider donating or becoming
|
||||
a sponsor of the project. You can support PyroFork via the ways shown below:
|
||||
|
||||
-----
|
||||
|
||||
GitHub Sponsor
|
||||
--------------
|
||||
|
||||
`Become a GitHub sponsor <https://github.com/sponsors/delivrance>`_.
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<a class="github-button"
|
||||
href="https://github.com/sponsors/delivrance"
|
||||
data-color-scheme="no-preference: light; light: light; dark: dark;"
|
||||
data-icon="octicon-heart" data-size="large"
|
||||
aria-label="Sponsor @delivrance on GitHub">Sponsor</a>
|
||||
|
||||
-----
|
||||
|
||||
LiberaPay Patron
|
||||
----------------
|
||||
|
||||
`Become a LiberaPay patron <https://liberapay.com/delivrance>`_.
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<script src="https://liberapay.com/delivrance/widgets/button.js"></script>
|
||||
|
||||
-----
|
||||
|
||||
OpenCollective Backer
|
||||
---------------------
|
||||
|
||||
`Become an OpenCollective backer <https://opencollective.com/pyrogram>`_
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<script src="https://opencollective.com/pyrogram/banner.js"></script>
|
||||
<script src="https://opencollective.com/pyrogram/banner.js"></script>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
Advanced Usage
|
||||
==============
|
||||
|
||||
Pyrogram's API -- which consists of well documented :doc:`methods <../api/methods/index>` and
|
||||
PyroFork's API -- which consists of well documented :doc:`methods <../api/methods/index>` and
|
||||
:doc:`types <../api/types/index>` -- exists to provide an easier interface to the more complex Telegram API.
|
||||
|
||||
In this section, you'll be shown the alternative way of communicating with Telegram using Pyrogram: the main "raw"
|
||||
In this section, you'll be shown the alternative way of communicating with Telegram using PyroFork: the main "raw"
|
||||
Telegram API with its functions and types.
|
||||
|
||||
.. contents:: Contents
|
||||
|
|
@ -25,12 +25,12 @@ take into consideration when working with the raw API.
|
|||
|
||||
.. tip::
|
||||
|
||||
Every available high-level method in Pyrogram is built on top of these raw functions.
|
||||
Every available high-level method in PyroFork is built on top of these raw functions.
|
||||
|
||||
Invoking Functions
|
||||
------------------
|
||||
|
||||
Unlike the :doc:`methods <../api/methods/index>` found in Pyrogram's API, which can be called in the usual simple way,
|
||||
Unlike the :doc:`methods <../api/methods/index>` found in PyroFork's API, which can be called in the usual simple way,
|
||||
functions to be invoked from the raw Telegram API have a different way of usage.
|
||||
|
||||
First of all, both :doc:`raw functions <../telegram/functions/index>` and :doc:`raw types <../telegram/types/index>`
|
||||
|
|
@ -92,7 +92,7 @@ Chat IDs
|
|||
--------
|
||||
|
||||
The way Telegram works makes it not possible to directly send a message to a user or a chat by using their IDs only.
|
||||
Instead, a pair of ``id`` and ``access_hash`` wrapped in a so called ``InputPeer`` is always needed. Pyrogram allows
|
||||
Instead, a pair of ``id`` and ``access_hash`` wrapped in a so called ``InputPeer`` is always needed. PyroFork allows
|
||||
sending messages with IDs only thanks to cached access hashes.
|
||||
|
||||
There are three different InputPeer types, one for each kind of Telegram entity.
|
||||
|
|
@ -102,17 +102,17 @@ Whenever an InputPeer is needed you must pass one of these:
|
|||
- :class:`~pyrogram.raw.types.InputPeerChat` - Basic Chats
|
||||
- :class:`~pyrogram.raw.types.InputPeerChannel` - Channels & Supergroups
|
||||
|
||||
But you don't necessarily have to manually instantiate each object because Pyrogram already provides
|
||||
But you don't necessarily have to manually instantiate each object because PyroFork already provides
|
||||
:meth:`~pyrogram.Client.resolve_peer` as a convenience utility method that returns the correct InputPeer
|
||||
by accepting a peer ID only.
|
||||
|
||||
Another thing to take into consideration about chat IDs is the way they are represented: they are all integers and
|
||||
all positive within their respective raw types.
|
||||
|
||||
Things are different when working with Pyrogram's API because having them in the same space could lead to
|
||||
collisions, and that's why Pyrogram uses a slightly different representation for each kind of ID.
|
||||
Things are different when working with PyroFork's API because having them in the same space could lead to
|
||||
collisions, and that's why PyroFork uses a slightly different representation for each kind of ID.
|
||||
|
||||
For example, given the ID *123456789*, here's how Pyrogram can tell entities apart:
|
||||
For example, given the ID *123456789*, here's how PyroFork can tell entities apart:
|
||||
|
||||
- ``+ID`` User: *123456789*
|
||||
- ``-ID`` Chat: *-123456789*
|
||||
|
|
@ -121,4 +121,4 @@ 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
|
||||
high-level method.
|
||||
|
||||
.. _Community: https://t.me/Pyrogram
|
||||
.. _Community: https://t.me/PyroFork
|
||||
|
|
@ -5,7 +5,7 @@ You can control the way your client appears in the Active Sessions menu of an of
|
|||
settings. By default you will see something like the following:
|
||||
|
||||
- Device Model: ``CPython x.y.z``
|
||||
- Application: ``Pyrogram x.y.z``
|
||||
- Application: ``PyroFork x.y.z``
|
||||
- System Version: ``Linux x.y.z``
|
||||
|
||||
.. contents:: Contents
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Creating Filters
|
||||
================
|
||||
|
||||
Pyrogram already provides lots of built-in :class:`~pyrogram.filters` to work with, but in case you can't find a
|
||||
PyroFork already provides lots of built-in :class:`~pyrogram.filters` to work with, but in case you can't find a
|
||||
specific one for your needs or want to build a custom filter by yourself you can use
|
||||
:meth:`filters.create() <pyrogram.filters.create>`.
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ button:
|
|||
|
||||
await app.send_message(
|
||||
"username", # Change this to your username or id
|
||||
"Pyrogram custom filter test",
|
||||
"PyroFork custom filter test",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[[InlineKeyboardButton("Press me", "pyrogram")]]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ Debugging
|
|||
=========
|
||||
|
||||
When working with the API, chances are you'll stumble upon bugs, get stuck and start wondering how to continue. Nothing
|
||||
to actually worry about since Pyrogram provides some commodities to help you in this.
|
||||
to actually worry about since PyroFork provides some commodities to help you in this.
|
||||
|
||||
.. contents:: Contents
|
||||
:backlinks: none
|
||||
|
|
@ -19,7 +19,7 @@ Caveman Debugging
|
|||
-- Brian Kernighan, "Unix for Beginners" (1979)
|
||||
|
||||
Adding ``print()`` statements in crucial parts of your code is by far the most ancient, yet efficient technique for
|
||||
debugging programs, especially considering the concurrent nature of the framework itself. Pyrogram goodness in this
|
||||
debugging programs, especially considering the concurrent nature of the framework itself. PyroFork goodness in this
|
||||
respect comes with the fact that any object can be nicely printed just by calling ``print(obj)``, thus giving to you
|
||||
an insight of all its inner details.
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ This will show a JSON representation of the object returned by :meth:`~pyrogram.
|
|||
"is_verified": false,
|
||||
"is_restricted": false,
|
||||
"is_support": false,
|
||||
"first_name": "Pyrogram",
|
||||
"first_name": "PyroFork",
|
||||
"photo": {
|
||||
"_": "ChatPhoto",
|
||||
"small_file_id": "AbCdE...EdCbA",
|
||||
|
|
@ -56,13 +56,13 @@ This will show a JSON representation of the object returned by :meth:`~pyrogram.
|
|||
}
|
||||
}
|
||||
|
||||
As you've probably guessed already, Pyrogram objects can be nested. That's how compound data are built, and nesting
|
||||
As you've probably guessed already, PyroFork objects can be nested. That's how compound data are built, and nesting
|
||||
keeps going until we are left with base data types only, such as ``str``, ``int``, ``bool``, etc.
|
||||
|
||||
Accessing Attributes
|
||||
--------------------
|
||||
|
||||
Even though you see a JSON output, it doesn't mean we are dealing with dictionaries; in fact, all Pyrogram types are
|
||||
Even though you see a JSON output, it doesn't mean we are dealing with dictionaries; in fact, all PyroFork types are
|
||||
fully-fledged Python objects and the correct way to access any attribute of them is by using the dot notation ``.``:
|
||||
|
||||
.. code-block:: python
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ Update propagation
|
|||
|
||||
Registering multiple handlers, each in a different group, becomes useful when you want to handle the same update more
|
||||
than once. Any incoming update will be sequentially processed by all of your registered functions by respecting the
|
||||
groups priority policy described above. Even in case any handler raises an unhandled exception, Pyrogram will still
|
||||
groups priority policy described above. Even in case any handler raises an unhandled exception, PyroFork will still
|
||||
continue to propagate the same update to the next groups until all the handlers are done. Example:
|
||||
|
||||
.. code-block:: python
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
MTProto vs. Bot API
|
||||
===================
|
||||
|
||||
Pyrogram is a framework written from the ground up that acts as a fully-fledged Telegram client based on the MTProto
|
||||
API. This means that Pyrogram is able to execute any official client and bot API action and more. This page will
|
||||
therefore show you why Pyrogram might be a better choice for your project by comparing the two APIs, but first, let's
|
||||
PyroFork is a framework written from the ground up that acts as a fully-fledged Telegram client based on the MTProto
|
||||
API. This means that PyroFork is able to execute any official client and bot API action and more. This page will
|
||||
therefore show you why PyroFork might be a better choice for your project by comparing the two APIs, but first, let's
|
||||
make it clear what actually is the MTProto and the Bot API.
|
||||
|
||||
.. contents:: Contents
|
||||
|
|
@ -23,7 +23,7 @@ The MTProto API on the other hand, is what people for convenience call the main
|
|||
from the Bot API. The main Telegram API is able to authorize both users and bots and is built on top of the MTProto
|
||||
encryption protocol by means of `binary data serialized`_ in a specific way, as described by the `TL language`_, and
|
||||
delivered using UDP, TCP or even HTTP as transport-layer protocol. Clients that make use of Telegram's main API, such as
|
||||
Pyrogram, implement all these details.
|
||||
PyroFork, implement all these details.
|
||||
|
||||
.. _MTProto: https://core.telegram.org/mtproto
|
||||
.. _binary data serialized: https://core.telegram.org/mtproto/serialize
|
||||
|
|
@ -45,8 +45,8 @@ servers using MTProto.
|
|||
Advantages of the MTProto API
|
||||
-----------------------------
|
||||
|
||||
Here is a non-exhaustive list of all the advantages in using MTProto-based libraries -- such as Pyrogram -- instead of
|
||||
the official HTTP Bot API. Using Pyrogram you can:
|
||||
Here is a non-exhaustive list of all the advantages in using MTProto-based libraries -- such as PyroFork -- instead of
|
||||
the official HTTP Bot API. Using PyroFork you can:
|
||||
|
||||
.. hlist::
|
||||
:columns: 1
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Proxy Settings
|
||||
==============
|
||||
|
||||
Pyrogram supports proxies with and without authentication. This feature allows Pyrogram to exchange data with Telegram
|
||||
PyroFork supports proxies with and without authentication. This feature allows PyroFork to exchange data with Telegram
|
||||
through an intermediate SOCKS 4/5 or HTTP (CONNECT) proxy server.
|
||||
|
||||
.. contents:: Contents
|
||||
|
|
@ -14,7 +14,7 @@ through an intermediate SOCKS 4/5 or HTTP (CONNECT) proxy server.
|
|||
Usage
|
||||
-----
|
||||
|
||||
To use Pyrogram with a proxy, use the *proxy* parameter in the Client class. If your proxy doesn't require authorization
|
||||
To use PyroFork with a proxy, use the *proxy* parameter in the Client class. If your proxy doesn't require authorization
|
||||
you can omit ``username`` and ``password``.
|
||||
|
||||
.. code-block:: python
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Scheduling Tasks
|
|||
Scheduling tasks means executing one or more functions periodically at pre-defined intervals or after a delay. This is
|
||||
useful, for example, to send recurring messages to specific chats or users.
|
||||
|
||||
This page will show examples on how to integrate Pyrogram with ``apscheduler`` in both asynchronous and
|
||||
This page will show examples on how to integrate PyroFork with ``apscheduler`` in both asynchronous and
|
||||
non-asynchronous contexts. For more detailed information, you can visit and learn from the library documentation.
|
||||
|
||||
.. contents:: Contents
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
Object Serialization
|
||||
====================
|
||||
|
||||
Serializing means converting a Pyrogram object, which exists as Python class instance, to a text string that can be
|
||||
easily shared and stored anywhere. Pyrogram provides two formats for serializing its objects: one good looking for
|
||||
Serializing means converting a PyroFork object, which exists as Python class instance, to a text string that can be
|
||||
easily shared and stored anywhere. PyroFork provides two formats for serializing its objects: one good looking for
|
||||
humans and another more compact for machines that is able to recover the original structures.
|
||||
|
||||
.. contents:: Contents
|
||||
|
|
@ -28,7 +28,7 @@ If you want a nicely formatted, human readable JSON representation of any object
|
|||
.. tip::
|
||||
|
||||
When using ``print()`` you don't actually need to use ``str()`` on the object because it is called automatically, we
|
||||
have done that above just to show you how to explicitly convert a Pyrogram object to JSON.
|
||||
have done that above just to show you how to explicitly convert a PyroFork object to JSON.
|
||||
|
||||
For Machines - repr(obj)
|
||||
------------------------
|
||||
|
|
@ -53,4 +53,4 @@ as the process requires the package to be in scope.
|
|||
.. note::
|
||||
|
||||
Type definitions are subject to changes between versions. You should make sure to store and load objects using the
|
||||
same Pyrogram version.
|
||||
same PyroFork version.
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
Smart Plugins
|
||||
=============
|
||||
|
||||
Pyrogram embeds a smart, lightweight yet powerful plugin system that is meant to further simplify the organization
|
||||
PyroFork embeds a smart, lightweight yet powerful plugin system that is meant to further simplify the organization
|
||||
of large projects and to provide a way for creating pluggable (modular) components that can be easily shared across
|
||||
different Pyrogram applications with minimal boilerplate code.
|
||||
different PyroFork applications with minimal boilerplate code.
|
||||
|
||||
.. tip::
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ after importing your modules, like this:
|
|||
This is an example application that replies in private chats with two messages: one containing the same
|
||||
text message you sent and the other containing the reversed text message.
|
||||
|
||||
Example: *"Pyrogram"* replies with *"Pyrogram"* and *"margoryP"*
|
||||
Example: *"PyroFork"* replies with *"PyroFork"* and *"margoryP"*
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ So, what if you could? Smart Plugins solve this issue by taking care of handlers
|
|||
Using Smart Plugins
|
||||
-------------------
|
||||
|
||||
Setting up your Pyrogram project to accommodate Smart Plugins is pretty straightforward:
|
||||
Setting up your PyroFork project to accommodate Smart Plugins is pretty straightforward:
|
||||
|
||||
#. Create a new folder to store all the plugins (e.g.: "plugins", "handlers", ...).
|
||||
#. Put your python files full of plugins inside. Organize them as you wish.
|
||||
|
|
@ -127,8 +127,8 @@ The first important thing to note is the new ``plugins`` folder. You can put *an
|
|||
each file can contain *any decorated function* (handlers) with one limitation: within a single module (file) you must
|
||||
use different names for each decorated function.
|
||||
|
||||
The second thing is telling Pyrogram where to look for your plugins: you can use the Client parameter "plugins";
|
||||
the *root* value must match the name of your plugins root folder. Your Pyrogram Client instance will **automatically**
|
||||
The second thing is telling PyroFork where to look for your plugins: you can use the Client parameter "plugins";
|
||||
the *root* value must match the name of your plugins root folder. Your PyroFork Client instance will **automatically**
|
||||
scan the folder upon starting to search for valid handlers and register them for you.
|
||||
|
||||
Then you'll notice you can now use decorators. That's right, you can apply the usual decorators to your callback
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Speedups
|
||||
========
|
||||
|
||||
Pyrogram's speed can be boosted up by using TgCrypto and uvloop.
|
||||
PyroFork's speed can be boosted up by using TgCrypto and uvloop.
|
||||
|
||||
.. contents:: Contents
|
||||
:backlinks: none
|
||||
|
|
@ -13,7 +13,7 @@ Pyrogram's speed can be boosted up by using TgCrypto and uvloop.
|
|||
TgCrypto
|
||||
--------
|
||||
|
||||
TgCrypto_ is a high-performance, easy-to-install cryptography library specifically written in C for Pyrogram as a Python
|
||||
TgCrypto_ is a high-performance, easy-to-install cryptography library specifically written in C for PyroFork as a Python
|
||||
extension. It is a replacement for a slower Python-only alternative and implements the cryptographic algorithms Telegram
|
||||
requires, namely: AES-256-IGE, AES-256-CTR and AES-256-CBC.
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ Installation
|
|||
Usage
|
||||
^^^^^
|
||||
|
||||
Pyrogram will automatically make use of TgCrypto when detected, all you need to do is to install it.
|
||||
PyroFork will automatically make use of TgCrypto when detected, all you need to do is to install it.
|
||||
|
||||
uvloop
|
||||
------
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Storage Engines
|
||||
===============
|
||||
|
||||
Every time you login to Telegram, some personal piece of data are created and held by both parties (the client, Pyrogram
|
||||
Every time you login to Telegram, some personal piece of data are created and held by both parties (the client, PyroFork
|
||||
and the server, Telegram). This session data is uniquely bound to your own account, indefinitely (until you logout or
|
||||
decide to manually terminate it) and is used to authorize a client to execute API calls on behalf of your identity.
|
||||
|
||||
|
|
@ -16,12 +16,12 @@ Persisting Sessions
|
|||
-------------------
|
||||
|
||||
In order to make a client reconnect successfully between restarts, that is, without having to start a new
|
||||
authorization process from scratch each time, Pyrogram needs to store the generated session data somewhere.
|
||||
authorization process from scratch each time, PyroFork needs to store the generated session data somewhere.
|
||||
|
||||
Different Storage Engines
|
||||
-------------------------
|
||||
|
||||
Pyrogram offers two different types of storage engines: a **File Storage** and a **Memory Storage**.
|
||||
PyroFork offers two different types of storage engines: a **File Storage** and a **Memory Storage**.
|
||||
These engines are well integrated in the framework and require a minimal effort to set up. Here's how they work:
|
||||
|
||||
File Storage
|
||||
|
|
@ -42,7 +42,7 @@ To use this type of engine, simply pass any name of your choice to the ``name``
|
|||
print(await app.get_me())
|
||||
|
||||
Once you successfully log in (either with a user or a bot identity), a session file will be created and saved to disk as
|
||||
``my_account.session``. Any subsequent client restart will make Pyrogram search for a file named that way and the
|
||||
``my_account.session``. Any subsequent client restart will make PyroFork search for a file named that way and the
|
||||
session database will be automatically loaded.
|
||||
|
||||
Memory Storage
|
||||
|
|
@ -86,5 +86,5 @@ login using the same session; the storage used will still be in-memory:
|
|||
async with Client("my_account", session_string=session_string) as app:
|
||||
print(await app.get_me())
|
||||
|
||||
Session strings are useful when you want to run authorized Pyrogram clients on platforms where their ephemeral
|
||||
Session strings are useful when you want to run authorized PyroFork clients on platforms where their ephemeral
|
||||
filesystems makes it harder for a file-based storage engine to properly work as intended.
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
Synchronous Usage
|
||||
=================
|
||||
|
||||
Pyrogram is an asynchronous framework and as such is subject to the asynchronous rules. It can, however, run in
|
||||
PyroFork is an asynchronous framework and as such is subject to the asynchronous rules. It can, however, run in
|
||||
synchronous mode (also known as non-asynchronous or sync/non-async for short). This mode exists mainly as a convenience
|
||||
way for invoking methods without the need of ``async``/``await`` keywords and the extra boilerplate, but **it's not the
|
||||
intended way to use the framework**.
|
||||
|
||||
You can use Pyrogram in this synchronous mode when you want to write something short and contained without the
|
||||
async boilerplate or in case you want to combine Pyrogram with other libraries that are not async.
|
||||
You can use PyroFork in this synchronous mode when you want to write something short and contained without the
|
||||
async boilerplate or in case you want to combine PyroFork with other libraries that are not async.
|
||||
|
||||
.. warning::
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ Synchronous Invocations
|
|||
-----------------------
|
||||
|
||||
The following is a standard example of running asynchronous functions with Python's asyncio.
|
||||
Pyrogram is being used inside the main function with its asynchronous interface.
|
||||
PyroFork is being used inside the main function with its asynchronous interface.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ Pyrogram is being used inside the main function with its asynchronous interface.
|
|||
|
||||
asyncio.run(main())
|
||||
|
||||
To run Pyrogram synchronously, use the non-async context manager as shown in the following example.
|
||||
To run PyroFork synchronously, use the non-async context manager as shown in the following example.
|
||||
As you can see, the non-async example becomes less cluttered.
|
||||
|
||||
.. code-block:: python
|
||||
|
|
@ -75,8 +75,8 @@ possible.
|
|||
uvloop usage
|
||||
------------
|
||||
|
||||
When using Pyrogram in its synchronous mode combined with uvloop, you need to call ``uvloop.install()`` before importing
|
||||
Pyrogram.
|
||||
When using PyroFork in its synchronous mode combined with uvloop, you need to call ``uvloop.install()`` before importing
|
||||
PyroFork.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Test Servers
|
||||
============
|
||||
|
||||
If you wish to test your application in a separate environment, Pyrogram is able to authorize your account into
|
||||
If you wish to test your application in a separate environment, PyroFork is able to authorize your account into
|
||||
Telegram's test servers without hassle. All you need to do is start a new session (e.g.: "my_account_test") using
|
||||
``test_mode=True``:
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Text Formatting
|
|||
.. role:: strike-italic
|
||||
:class: strike-italic
|
||||
|
||||
Pyrogram uses a custom Markdown dialect for text formatting which adds some unique features that make writing styled
|
||||
PyroFork uses a custom Markdown dialect for text formatting which adds some unique features that make writing styled
|
||||
texts easier in both Markdown and HTML. You can send sophisticated text messages and media captions using a
|
||||
variety of decorations that can also be nested in order to combine multiple styles together.
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ Basic Styles
|
|||
------------
|
||||
|
||||
When formatting your messages, you can choose between Markdown-style, HTML-style or both (default). The following is a
|
||||
list of the basic styles currently supported by Pyrogram.
|
||||
list of the basic styles currently supported by PyroFork.
|
||||
|
||||
- **bold**
|
||||
- *italic*
|
||||
|
|
|
|||
|
|
@ -109,6 +109,6 @@ More handlers using different filters can also live together.
|
|||
print("This is the /help command")
|
||||
|
||||
|
||||
@app.on_message(filters.chat("PyrogramChat"))
|
||||
@app.on_message(filters.chat("PyroForkChat"))
|
||||
async def from_pyrogramchat(client, message):
|
||||
print("New message in @PyrogramChat")
|
||||
print("New message in @PyroForkChat")
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ Voice Calls
|
|||
===========
|
||||
|
||||
Both private voice calls and group voice calls are currently supported by third-party, external libraries that integrate
|
||||
with Pyrogram.
|
||||
with PyroFork.
|
||||
|
||||
Libraries
|
||||
---------
|
||||
|
|
|
|||
Loading…
Reference in a new issue