mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Pyrofork: Full rebrand
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
a88ae52938
commit
8353e5a2a2
593 changed files with 5228 additions and 4866 deletions
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
|
@ -6,7 +6,7 @@ body:
|
|||
label: Checklist
|
||||
description: Invalid, incomplete or inadequate issue reports may not be taken into consideration
|
||||
options:
|
||||
- label: I am sure the error is coming from Pyrogram's code and not elsewhere
|
||||
- label: I am sure the error is coming from Pyrofork's code and not elsewhere
|
||||
required: true
|
||||
- label: I have searched in the issue tracker for similar bug reports, including closed ones
|
||||
required: true
|
||||
|
|
@ -37,7 +37,7 @@ body:
|
|||
label: Code example
|
||||
description: Provide a [minimal, complete, consistently reproducible](https://stackoverflow.com/help/minimal-reproducible-example) and properly formatted example involving normal usages (if applicable)
|
||||
placeholder: |
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
...
|
||||
render: python
|
||||
|
||||
|
|
|
|||
12
.github/ISSUE_TEMPLATE/config.yml
vendored
12
.github/ISSUE_TEMPLATE/config.yml
vendored
|
|
@ -1,8 +1,8 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Ask Pyrogram related questions
|
||||
url: https://stackoverflow.com/questions/tagged/pyrogram
|
||||
about: This place is only for reporting issues about Pyrogram. You can ask questions at StackOverflow.
|
||||
- name: Join the Telegram channel
|
||||
url: https://t.me/pyrogram
|
||||
about: Join the official channel and stay tuned for news, updates and announcements.
|
||||
- name: Ask Pyrofork related questions
|
||||
url: https://stackoverflow.com/questions/tagged/pyrofork
|
||||
about: This place is only for reporting issues about Pyrofork. You can ask questions at StackOverflow.
|
||||
- name: Join the Telegram chat
|
||||
url: https://t.me/MayuriChan_Chat
|
||||
about: Join the official chat and stay tuned for news, updates and announcements.
|
||||
1
.github/workflows/build-docs.yml
vendored
1
.github/workflows/build-docs.yml
vendored
|
|
@ -6,6 +6,7 @@ on:
|
|||
- "*"
|
||||
branches:
|
||||
- staging
|
||||
- dev/*
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
|
|||
2
.github/workflows/python.yml
vendored
2
.github/workflows/python.yml
vendored
|
|
@ -1,4 +1,4 @@
|
|||
name: Pyrogram
|
||||
name: Pyrofork
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
|
|
|
|||
12
.gitignore
vendored
12
.gitignore
vendored
|
|
@ -6,12 +6,12 @@ main.py
|
|||
unknown_errors.txt
|
||||
.DS_Store
|
||||
|
||||
# Pyrogram generated code
|
||||
pyrogram/errors/exceptions/
|
||||
pyrogram/raw/functions/
|
||||
pyrogram/raw/types/
|
||||
pyrogram/raw/base/
|
||||
pyrogram/raw/all.py
|
||||
# Pyrofork generated code
|
||||
pyrofork/errors/exceptions/
|
||||
pyrofork/raw/functions/
|
||||
pyrofork/raw/types/
|
||||
pyrofork/raw/base/
|
||||
pyrofork/raw/all.py
|
||||
docs/source/telegram
|
||||
docs/source/api/methods/
|
||||
docs/source/api/bound-methods/
|
||||
|
|
|
|||
10
MANIFEST.in
10
MANIFEST.in
|
|
@ -4,8 +4,8 @@ recursive-include compiler *.py *.tl *.tsv *.txt
|
|||
recursive-include tests *.py
|
||||
|
||||
## Exclude
|
||||
prune pyrogram/errors/exceptions
|
||||
prune pyrogram/raw/functions
|
||||
prune pyrogram/raw/types
|
||||
prune pyrogram/raw/base
|
||||
exclude pyrogram/raw/all.py
|
||||
prune pyrofork/errors/exceptions
|
||||
prune pyrofork/raw/functions
|
||||
prune pyrofork/raw/types
|
||||
prune pyrofork/raw/base
|
||||
exclude pyrofork/raw/all.py
|
||||
|
|
|
|||
4
Makefile
4
Makefile
|
|
@ -1,7 +1,7 @@
|
|||
VENV := venv
|
||||
PYTHON := $(VENV)/bin/python
|
||||
HOST = $(shell ifconfig | grep "inet " | tail -1 | cut -d\ -f2)
|
||||
TAG = v$(shell grep -E '__version__ = ".*"' pyrogram/__init__.py | cut -d\" -f2)
|
||||
TAG = v$(shell grep -E '__version__ = ".*"' pyrofork/__init__.py | cut -d\" -f2)
|
||||
|
||||
RM := rm -rf
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ clean-build:
|
|||
$(RM) *.egg-info build dist
|
||||
|
||||
clean-api:
|
||||
$(RM) pyrogram/errors/exceptions pyrogram/raw/all.py pyrogram/raw/base pyrogram/raw/functions pyrogram/raw/types
|
||||
$(RM) pyrofork/errors/exceptions pyrofork/raw/all.py pyrofork/raw/base pyrofork/raw/functions pyrofork/raw/types
|
||||
|
||||
clean:
|
||||
make clean-build
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
<p align="center">
|
||||
<a href="https://github.com/Mayuri-Chan/pyrofok">
|
||||
<img src="https://docs.pyrogram.org/_static/pyrogram.png" alt="Pyrofork" width="128">
|
||||
</a>
|
||||
<br>
|
||||
<b>Telegram MTProto API Framework for Python</b>
|
||||
<br>
|
||||
|
|
@ -23,7 +20,7 @@
|
|||
> Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots
|
||||
|
||||
``` python
|
||||
from pyrogram import Client, filters
|
||||
from pyrofork import Client, filters
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,31 +1,42 @@
|
|||
#!/bin/bash
|
||||
export DOCS_KEY
|
||||
export VENV=$(pwd)/venv
|
||||
VENV="$(pwd)"/venv
|
||||
export VENV
|
||||
|
||||
make clean
|
||||
make clean-docs
|
||||
make venv
|
||||
make api
|
||||
"$VENV"/bin/pip install -e '.[docs]'
|
||||
cd compiler/docs && "$VENV"/bin/python compiler.py
|
||||
cd ../..
|
||||
cd compiler/docs || exit 1 && "$VENV"/bin/python compiler.py
|
||||
cd ../.. || exit 1
|
||||
"$VENV"/bin/sphinx-build -b html "docs/source" "docs/build/html" -j auto
|
||||
git clone https://wulan17:"$DOCS_KEY"@github.com/Mayuri-Chan/pyrofork-docs.git
|
||||
cd pyrofork-docs
|
||||
refs=$(echo "$GITHUB_REF" | cut -d '/' -f "1 2")
|
||||
if [[ "$refs" == "refs/tags" ]]; then
|
||||
mkdir -p main
|
||||
cd main
|
||||
rm -rf _includes api genindex.html intro py-modindex.html sitemap.xml support.html topics _static faq index.html objects.inv searchindex.js start telegram
|
||||
cp -r ../../docs/build/html/* .
|
||||
branch="main"
|
||||
elif [[ "$GITHUB_REF" == "refs/heads/staging" ]]; then
|
||||
branch="staging"
|
||||
else
|
||||
mkdir -p staging
|
||||
cd staging
|
||||
rm -rf _includes api genindex.html intro py-modindex.html sitemap.xml support.html topics _static faq index.html objects.inv searchindex.js start telegram
|
||||
cp -r ../../docs/build/html/* .
|
||||
b="$(echo "$GITHUB_REF" | cut -d '/' -f '3 4')"
|
||||
if [[ $(echo "$b" | cut -d '/' -f 1 ) == "dev" ]]; then
|
||||
b="$(echo "$b" | cut -d '/' -f 2)"
|
||||
if [[ "$b" =~ ^[0-9]\.[0-9]\.x ]]; then
|
||||
branch="$b"
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
cd pyrofork-docs || exit 1
|
||||
mkdir -p "$branch"
|
||||
cd "$branch" || exit 1
|
||||
rm -rf _includes api genindex.html intro py-modindex.html sitemap.xml support.html topics _static faq index.html objects.inv searchindex.js start telegram
|
||||
cp -r ../../docs/build/html/* .
|
||||
git config --local user.name "Mayuri-Chan"
|
||||
git config --local user.email "mayuri@mayuri.my.id"
|
||||
git add --all
|
||||
git commit -a -m "docs: $(echo $GITHUB_REF | cut -d '/' -f 3): Update docs $(date '+%Y-%m-%d | %H:%m:%S %p %Z')" --signoff
|
||||
git commit -a -m "docs: $branch: Update docs $(date '+%Y-%m-%d | %H:%m:%S %p %Z')" --signoff
|
||||
git push -u origin --all
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ from typing import NamedTuple, List, Tuple
|
|||
# from black import format_str, FileMode
|
||||
|
||||
HOME_PATH = Path("compiler/api")
|
||||
DESTINATION_PATH = Path("pyrogram/raw")
|
||||
DESTINATION_PATH = Path("pyrofork/raw")
|
||||
NOTICE_PATH = "NOTICE"
|
||||
|
||||
SECTION_RE = re.compile(r"---(\w+)---")
|
||||
|
|
@ -177,13 +177,13 @@ def get_docstring_arg_type(t: str):
|
|||
else:
|
||||
return f"``{t.lower()}``"
|
||||
elif t == "TLObject" or t == "X":
|
||||
return "Any object from :obj:`~pyrogram.raw.types`"
|
||||
return "Any object from :obj:`~pyrofork.raw.types`"
|
||||
elif t == "!X":
|
||||
return "Any function from :obj:`~pyrogram.raw.functions`"
|
||||
return "Any function from :obj:`~pyrofork.raw.functions`"
|
||||
elif t.lower().startswith("vector"):
|
||||
return "List of " + get_docstring_arg_type(t.split("<", 1)[1][:-1])
|
||||
else:
|
||||
return f":obj:`{t} <pyrogram.raw.base.{t}>`"
|
||||
return f":obj:`{t} <pyrofork.raw.base.{t}>`"
|
||||
|
||||
|
||||
def get_references(t: str, kind: str):
|
||||
|
|
@ -340,7 +340,7 @@ def start(format: bool = False):
|
|||
|
||||
docstring += f"\n\n Constructors:\n" \
|
||||
f" This base type has {constr_count} constructor{'s' if constr_count > 1 else ''} available.\n\n" \
|
||||
f" .. currentmodule:: pyrogram.raw.types\n\n" \
|
||||
f" .. currentmodule:: pyrofork.raw.types\n\n" \
|
||||
f" .. autosummary::\n" \
|
||||
f" :nosignatures:\n\n" \
|
||||
f" {items}"
|
||||
|
|
@ -350,7 +350,7 @@ def start(format: bool = False):
|
|||
if references:
|
||||
docstring += f"\n\n Functions:\n This object can be returned by " \
|
||||
f"{ref_count} function{'s' if ref_count > 1 else ''}.\n\n" \
|
||||
f" .. currentmodule:: pyrogram.raw.functions\n\n" \
|
||||
f" .. currentmodule:: pyrofork.raw.functions\n\n" \
|
||||
f" .. autosummary::\n" \
|
||||
f" :nosignatures:\n\n" \
|
||||
f" " + references
|
||||
|
|
@ -423,7 +423,7 @@ def start(format: bool = False):
|
|||
constructor_docs = "Telegram API type."
|
||||
|
||||
docstring += constructor_docs + "\n"
|
||||
docstring += f"\n Constructor of :obj:`~pyrogram.raw.base.{c.qualtype}`."
|
||||
docstring += f"\n Constructor of :obj:`~pyrofork.raw.base.{c.qualtype}`."
|
||||
else:
|
||||
function_docs = docs["method"].get(c.qualname, None)
|
||||
|
||||
|
|
@ -444,7 +444,7 @@ def start(format: bool = False):
|
|||
if references:
|
||||
docstring += f"\n Functions:\n This object can be returned by " \
|
||||
f"{count} function{'s' if count > 1 else ''}.\n\n" \
|
||||
f" .. currentmodule:: pyrogram.raw.functions\n\n" \
|
||||
f" .. currentmodule:: pyrofork.raw.functions\n\n" \
|
||||
f" .. autosummary::\n" \
|
||||
f" :nosignatures:\n\n" \
|
||||
f" " + references
|
||||
|
|
@ -634,23 +634,23 @@ def start(format: bool = False):
|
|||
f.write("objects = {")
|
||||
|
||||
for c in combinators:
|
||||
f.write(f'\n {c.id}: "pyrogram.raw.{c.section}.{c.qualname}",')
|
||||
f.write(f'\n {c.id}: "pyrofork.raw.{c.section}.{c.qualname}",')
|
||||
|
||||
f.write('\n 0xbc799737: "pyrogram.raw.core.BoolFalse",')
|
||||
f.write('\n 0x997275b5: "pyrogram.raw.core.BoolTrue",')
|
||||
f.write('\n 0x1cb5c415: "pyrogram.raw.core.Vector",')
|
||||
f.write('\n 0x73f1f8dc: "pyrogram.raw.core.MsgContainer",')
|
||||
f.write('\n 0xae500895: "pyrogram.raw.core.FutureSalts",')
|
||||
f.write('\n 0x0949d9dc: "pyrogram.raw.core.FutureSalt",')
|
||||
f.write('\n 0x3072cfa1: "pyrogram.raw.core.GzipPacked",')
|
||||
f.write('\n 0x5bb8e511: "pyrogram.raw.core.Message",')
|
||||
f.write('\n 0xbc799737: "pyrofork.raw.core.BoolFalse",')
|
||||
f.write('\n 0x997275b5: "pyrofork.raw.core.BoolTrue",')
|
||||
f.write('\n 0x1cb5c415: "pyrofork.raw.core.Vector",')
|
||||
f.write('\n 0x73f1f8dc: "pyrofork.raw.core.MsgContainer",')
|
||||
f.write('\n 0xae500895: "pyrofork.raw.core.FutureSalts",')
|
||||
f.write('\n 0x0949d9dc: "pyrofork.raw.core.FutureSalt",')
|
||||
f.write('\n 0x3072cfa1: "pyrofork.raw.core.GzipPacked",')
|
||||
f.write('\n 0x5bb8e511: "pyrofork.raw.core.Message",')
|
||||
|
||||
f.write("\n}\n")
|
||||
|
||||
|
||||
if "__main__" == __name__:
|
||||
HOME_PATH = Path(".")
|
||||
DESTINATION_PATH = Path("../../pyrogram/raw")
|
||||
DESTINATION_PATH = Path("../../pyrofork/raw")
|
||||
NOTICE_PATH = Path("../../NOTICE")
|
||||
|
||||
start(format=False)
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
from io import BytesIO
|
||||
|
||||
from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
|
||||
from pyrogram.raw.core import TLObject
|
||||
from pyrogram import raw
|
||||
from pyrofork.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
|
||||
from pyrofork.raw.core import TLObject
|
||||
from pyrofork import raw
|
||||
from typing import List, Optional, Any
|
||||
|
||||
{warning}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
{warning}
|
||||
|
||||
from typing import Union
|
||||
from pyrogram import raw
|
||||
from pyrogram.raw.core import TLObject
|
||||
from pyrofork import raw
|
||||
from pyrofork.raw.core import TLObject
|
||||
|
||||
{name} = Union[{types}]
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ class {name}: # type: ignore
|
|||
"""{docstring}
|
||||
"""
|
||||
|
||||
QUALNAME = "pyrogram.raw.base.{qualname}"
|
||||
QUALNAME = "pyrofork.raw.base.{qualname}"
|
||||
|
||||
def __init__(self):
|
||||
raise TypeError("Base types can only be used for type checking purposes: "
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ HOME = "compiler/docs"
|
|||
DESTINATION = "docs/source/telegram"
|
||||
PYROGRAM_API_DEST = "docs/source/api"
|
||||
|
||||
FUNCTIONS_PATH = "pyrogram/raw/functions"
|
||||
TYPES_PATH = "pyrogram/raw/types"
|
||||
BASE_PATH = "pyrogram/raw/base"
|
||||
FUNCTIONS_PATH = "pyrofork/raw/functions"
|
||||
TYPES_PATH = "pyrofork/raw/types"
|
||||
BASE_PATH = "pyrofork/raw/base"
|
||||
|
||||
FUNCTIONS_BASE = "functions"
|
||||
TYPES_BASE = "types"
|
||||
|
|
@ -79,7 +79,7 @@ def generate(source_path, base):
|
|||
page_template.format(
|
||||
title=full_name,
|
||||
title_markup="=" * len(full_name),
|
||||
full_class_path="pyrogram.raw.{}".format(
|
||||
full_class_path="pyrofork.raw.{}".format(
|
||||
".".join(full_path.split("/")[:-1]) + "." + name
|
||||
)
|
||||
)
|
||||
|
|
@ -101,14 +101,14 @@ def generate(source_path, base):
|
|||
|
||||
if k != base:
|
||||
inner_path = base + "/" + k + "/index" + ".rst"
|
||||
module = "pyrogram.raw.{}.{}".format(base, k)
|
||||
module = "pyrofork.raw.{}.{}".format(base, k)
|
||||
else:
|
||||
for i in sorted(list(all_entities), reverse=True):
|
||||
if i != base:
|
||||
entities.insert(0, "{0}/index".format(i))
|
||||
|
||||
inner_path = base + "/index" + ".rst"
|
||||
module = "pyrogram.raw.{}".format(base)
|
||||
module = "pyrofork.raw.{}".format(base)
|
||||
|
||||
with open(DESTINATION + "/" + inner_path, "w", encoding="utf-8") as f:
|
||||
if k == base:
|
||||
|
|
@ -127,7 +127,7 @@ def generate(source_path, base):
|
|||
f.write("\n")
|
||||
|
||||
|
||||
def pyrogram_api():
|
||||
def pyrofork_api():
|
||||
def get_title_list(s: str) -> list:
|
||||
return [i.strip() for i in [j.strip() for j in s.split("\n") if j] if i]
|
||||
|
||||
|
|
@ -403,7 +403,7 @@ def pyrogram_api():
|
|||
title = "{}()".format(method)
|
||||
|
||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
||||
f2.write(".. automethod:: pyrogram.Client.{}()".format(method))
|
||||
f2.write(".. automethod:: pyrofork.Client.{}()".format(method))
|
||||
|
||||
functions = ["idle", "compose"]
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ def pyrogram_api():
|
|||
title = "{}()".format(func)
|
||||
|
||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
||||
f2.write(".. autofunction:: pyrogram.{}()".format(func))
|
||||
f2.write(".. autofunction:: pyrofork.{}()".format(func))
|
||||
|
||||
f.write(template.format(**fmt_keys))
|
||||
|
||||
|
|
@ -615,7 +615,7 @@ def pyrogram_api():
|
|||
title = "{}".format(type)
|
||||
|
||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
||||
f2.write(".. autoclass:: pyrogram.types.{}()\n".format(type))
|
||||
f2.write(".. autoclass:: pyrofork.types.{}()\n".format(type))
|
||||
|
||||
f.write(template.format(**fmt_keys))
|
||||
|
||||
|
|
@ -761,7 +761,7 @@ def pyrogram_api():
|
|||
title = "{}()".format(bm)
|
||||
|
||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
||||
f2.write(".. automethod:: pyrogram.types.{}()".format(bm))
|
||||
f2.write(".. automethod:: pyrofork.types.{}()".format(bm))
|
||||
|
||||
f.write(template.format(**fmt_keys))
|
||||
|
||||
|
|
@ -781,13 +781,13 @@ def start():
|
|||
generate(TYPES_PATH, TYPES_BASE)
|
||||
generate(FUNCTIONS_PATH, FUNCTIONS_BASE)
|
||||
generate(BASE_PATH, BASE_BASE)
|
||||
pyrogram_api()
|
||||
pyrofork_api()
|
||||
|
||||
|
||||
if "__main__" == __name__:
|
||||
FUNCTIONS_PATH = "../../pyrogram/raw/functions"
|
||||
TYPES_PATH = "../../pyrogram/raw/types"
|
||||
BASE_PATH = "../../pyrogram/raw/base"
|
||||
FUNCTIONS_PATH = "../../pyrofork/raw/functions"
|
||||
TYPES_PATH = "../../pyrofork/raw/types"
|
||||
BASE_PATH = "../../pyrofork/raw/base"
|
||||
HOME = "."
|
||||
DESTINATION = "../../docs/source/telegram"
|
||||
PYROGRAM_API_DEST = "../../docs/source/api"
|
||||
|
|
|
|||
4
compiler/docs/template/bound-methods.rst
vendored
4
compiler/docs/template/bound-methods.rst
vendored
|
|
@ -7,7 +7,7 @@ some of the required arguments.
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ some of the required arguments.
|
|||
|
||||
-----
|
||||
|
||||
.. currentmodule:: pyrogram.types
|
||||
.. currentmodule:: pyrofork.types
|
||||
|
||||
Message
|
||||
-------
|
||||
|
|
|
|||
12
compiler/docs/template/methods.rst
vendored
12
compiler/docs/template/methods.rst
vendored
|
|
@ -1,13 +1,13 @@
|
|||
Available Methods
|
||||
=================
|
||||
|
||||
This page is about Pyrofork methods. All the methods listed here are bound to a :class:`~pyrogram.Client` instance,
|
||||
except for :meth:`~pyrogram.idle()` and :meth:`~pyrogram.compose()`, which are special functions that can be found in
|
||||
This page is about Pyrofork methods. All the methods listed here are bound to a :class:`~pyrofork.Client` instance,
|
||||
except for :meth:`~pyrofork.idle()` and :meth:`~pyrofork.compose()`, which are special functions that can be found in
|
||||
the main package directly.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ the main package directly.
|
|||
|
||||
-----
|
||||
|
||||
.. currentmodule:: pyrogram.Client
|
||||
.. currentmodule:: pyrofork.Client
|
||||
|
||||
Utilities
|
||||
---------
|
||||
|
|
@ -31,7 +31,7 @@ Utilities
|
|||
|
||||
{utilities}
|
||||
|
||||
.. currentmodule:: pyrogram
|
||||
.. currentmodule:: pyrofork
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
|
@ -45,7 +45,7 @@ Utilities
|
|||
idle
|
||||
compose
|
||||
|
||||
.. currentmodule:: pyrogram.Client
|
||||
.. currentmodule:: pyrofork.Client
|
||||
|
||||
Conversation
|
||||
------------
|
||||
|
|
|
|||
6
compiler/docs/template/types.rst
vendored
6
compiler/docs/template/types.rst
vendored
|
|
@ -1,13 +1,13 @@
|
|||
Available Types
|
||||
===============
|
||||
|
||||
This page is about Pyrofork Types. All types listed here are available through the ``pyrogram.types`` package.
|
||||
This page is about Pyrofork Types. All types listed here are available through the ``pyrofork.types`` package.
|
||||
Unless required as argument to a client method, most of the types don't need to be manually instantiated because they
|
||||
are only returned by other methods. You also don't need to import them, unless you want to type-hint your variables.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram.types import User, Message, ...
|
||||
from pyrofork.types import User, Message, ...
|
||||
|
||||
.. note::
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ are only returned by other methods. You also don't need to import them, unless y
|
|||
|
||||
-----
|
||||
|
||||
.. currentmodule:: pyrogram.types
|
||||
.. currentmodule:: pyrofork.types
|
||||
|
||||
Users & Chats
|
||||
-------------
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import re
|
|||
import shutil
|
||||
|
||||
HOME = "compiler/errors"
|
||||
DEST = "pyrogram/errors/exceptions"
|
||||
DEST = "pyrofork/errors/exceptions"
|
||||
NOTICE_PATH = "NOTICE"
|
||||
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ def start():
|
|||
|
||||
if "__main__" == __name__:
|
||||
HOME = "."
|
||||
DEST = "../../pyrogram/errors/exceptions"
|
||||
DEST = "../../pyrofork/errors/exceptions"
|
||||
NOTICE_PATH = "../../NOTICE"
|
||||
|
||||
start()
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ This page is about the Client class, which exposes high-level methods for an eas
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
@ -21,4 +21,4 @@ This page is about the Client class, which exposes high-level methods for an eas
|
|||
Details
|
||||
-------
|
||||
|
||||
.. autoclass:: pyrogram.Client()
|
||||
.. autoclass:: pyrofork.Client()
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ Decorators
|
|||
|
||||
Decorators are able to register callback functions for handling updates in a much easier and cleaner way compared to
|
||||
:doc:`Handlers <handlers>`; they do so by instantiating the correct handler and calling
|
||||
:meth:`~pyrogram.Client.add_handler` automatically. All you need to do is adding the decorators on top of your
|
||||
:meth:`~pyrofork.Client.add_handler` automatically. All you need to do is adding the decorators on top of your
|
||||
functions.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ functions.
|
|||
|
||||
-----
|
||||
|
||||
.. currentmodule:: pyrogram
|
||||
.. currentmodule:: pyrofork
|
||||
|
||||
Index
|
||||
-----
|
||||
|
|
@ -57,18 +57,18 @@ Details
|
|||
-------
|
||||
|
||||
.. Decorators
|
||||
.. autodecorator:: pyrogram.Client.on_message()
|
||||
.. autodecorator:: pyrogram.Client.on_edited_message()
|
||||
.. autodecorator:: pyrogram.Client.on_callback_query()
|
||||
.. autodecorator:: pyrogram.Client.on_message_reaction_updated()
|
||||
.. autodecorator:: pyrogram.Client.on_message_reaction_count_updated()
|
||||
.. autodecorator:: pyrogram.Client.on_inline_query()
|
||||
.. autodecorator:: pyrogram.Client.on_chosen_inline_result()
|
||||
.. autodecorator:: pyrogram.Client.on_chat_member_updated()
|
||||
.. autodecorator:: pyrogram.Client.on_chat_join_request()
|
||||
.. autodecorator:: pyrogram.Client.on_deleted_messages()
|
||||
.. autodecorator:: pyrogram.Client.on_user_status()
|
||||
.. autodecorator:: pyrogram.Client.on_story()
|
||||
.. autodecorator:: pyrogram.Client.on_poll()
|
||||
.. autodecorator:: pyrogram.Client.on_disconnect()
|
||||
.. autodecorator:: pyrogram.Client.on_raw_update()
|
||||
.. autodecorator:: pyrofork.Client.on_message()
|
||||
.. autodecorator:: pyrofork.Client.on_edited_message()
|
||||
.. autodecorator:: pyrofork.Client.on_callback_query()
|
||||
.. autodecorator:: pyrofork.Client.on_message_reaction_updated()
|
||||
.. autodecorator:: pyrofork.Client.on_message_reaction_count_updated()
|
||||
.. autodecorator:: pyrofork.Client.on_inline_query()
|
||||
.. autodecorator:: pyrofork.Client.on_chosen_inline_result()
|
||||
.. autodecorator:: pyrofork.Client.on_chat_member_updated()
|
||||
.. autodecorator:: pyrofork.Client.on_chat_join_request()
|
||||
.. autodecorator:: pyrofork.Client.on_deleted_messages()
|
||||
.. autodecorator:: pyrofork.Client.on_user_status()
|
||||
.. autodecorator:: pyrofork.Client.on_story()
|
||||
.. autodecorator:: pyrofork.Client.on_poll()
|
||||
.. autodecorator:: pyrofork.Client.on_disconnect()
|
||||
.. autodecorator:: pyrofork.Client.on_raw_update()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
ChatAction
|
||||
==========
|
||||
|
||||
.. autoclass:: pyrogram.enums.ChatAction()
|
||||
.. autoclass:: pyrofork.enums.ChatAction()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
ChatEventAction
|
||||
===============
|
||||
|
||||
.. autoclass:: pyrogram.enums.ChatEventAction()
|
||||
.. autoclass:: pyrofork.enums.ChatEventAction()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
ChatMemberStatus
|
||||
================
|
||||
|
||||
.. autoclass:: pyrogram.enums.ChatMemberStatus()
|
||||
.. autoclass:: pyrofork.enums.ChatMemberStatus()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
ChatMembersFilter
|
||||
=================
|
||||
|
||||
.. autoclass:: pyrogram.enums.ChatMembersFilter()
|
||||
.. autoclass:: pyrofork.enums.ChatMembersFilter()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
ChatType
|
||||
========
|
||||
|
||||
.. autoclass:: pyrogram.enums.ChatType()
|
||||
.. autoclass:: pyrofork.enums.ChatType()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
ListenerTypes
|
||||
=============
|
||||
|
||||
.. autoclass:: pyrogram.enums.ListenerTypes()
|
||||
.. autoclass:: pyrofork.enums.ListenerTypes()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
MessageEntityType
|
||||
=================
|
||||
|
||||
.. autoclass:: pyrogram.enums.MessageEntityType()
|
||||
.. autoclass:: pyrofork.enums.MessageEntityType()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
MessageMediaType
|
||||
================
|
||||
|
||||
.. autoclass:: pyrogram.enums.MessageMediaType()
|
||||
.. autoclass:: pyrofork.enums.MessageMediaType()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
MessageServiceType
|
||||
==================
|
||||
|
||||
.. autoclass:: pyrogram.enums.MessageServiceType()
|
||||
.. autoclass:: pyrofork.enums.MessageServiceType()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
MessagesFilter
|
||||
==============
|
||||
|
||||
.. autoclass:: pyrogram.enums.MessagesFilter()
|
||||
.. autoclass:: pyrofork.enums.MessagesFilter()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
NextCodeType
|
||||
============
|
||||
|
||||
.. autoclass:: pyrogram.enums.NextCodeType()
|
||||
.. autoclass:: pyrofork.enums.NextCodeType()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
ParseMode
|
||||
=========
|
||||
|
||||
.. autoclass:: pyrogram.enums.ParseMode()
|
||||
.. autoclass:: pyrofork.enums.ParseMode()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
PollType
|
||||
========
|
||||
|
||||
.. autoclass:: pyrogram.enums.PollType()
|
||||
.. autoclass:: pyrofork.enums.PollType()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
ReactionType
|
||||
============
|
||||
|
||||
.. autoclass:: pyrogram.enums.ReactionType()
|
||||
.. autoclass:: pyrofork.enums.ReactionType()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
SentCodeType
|
||||
============
|
||||
|
||||
.. autoclass:: pyrogram.enums.SentCodeType()
|
||||
.. autoclass:: pyrofork.enums.SentCodeType()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
StoriesPrivacyRules
|
||||
===================
|
||||
|
||||
.. autoclass:: pyrogram.enums.StoriesPrivacyRules()
|
||||
.. autoclass:: pyrofork.enums.StoriesPrivacyRules()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
StoryPrivacy
|
||||
============
|
||||
|
||||
.. autoclass:: pyrogram.enums.StoryPrivacy()
|
||||
.. autoclass:: pyrofork.enums.StoryPrivacy()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
UserStatus
|
||||
==========
|
||||
|
||||
.. autoclass:: pyrogram.enums.UserStatus()
|
||||
.. autoclass:: pyrofork.enums.UserStatus()
|
||||
:members:
|
||||
|
||||
.. raw:: html
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ to apply only a valid value among the expected ones.
|
|||
|
||||
-----
|
||||
|
||||
.. currentmodule:: pyrogram.enums
|
||||
.. currentmodule:: pyrofork.enums
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
RPC Errors
|
||||
==========
|
||||
|
||||
All Pyrofork API errors live inside the ``errors`` sub-package: ``pyrogram.errors``.
|
||||
All Pyrofork API errors live inside the ``errors`` sub-package: ``pyrofork.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
|
||||
|
||||
from pyrogram.errors import FloodWait
|
||||
from pyrofork.errors import FloodWait
|
||||
|
||||
try:
|
||||
...
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@ Filters are objects that can be used to filter the content of incoming updates.
|
|||
Details
|
||||
-------
|
||||
|
||||
.. automodule:: pyrogram.filters
|
||||
.. automodule:: pyrofork.filters
|
||||
:members:
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ For a much more convenient way of registering callback functions have a look at
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrogram.handlers import MessageHandler
|
||||
from pyrofork import Client
|
||||
from pyrofork.handlers import MessageHandler
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ For a much more convenient way of registering callback functions have a look at
|
|||
|
||||
-----
|
||||
|
||||
.. currentmodule:: pyrogram.handlers
|
||||
.. currentmodule:: pyrofork.handlers
|
||||
|
||||
Index
|
||||
-----
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import sys
|
|||
|
||||
sys.path.insert(0, os.path.abspath("../.."))
|
||||
|
||||
from pyrogram import __version__
|
||||
from pyrofork import __version__
|
||||
|
||||
from pygments.styles.friendly import FriendlyStyle
|
||||
|
||||
|
|
@ -102,11 +102,11 @@ html_theme_options = {
|
|||
],
|
||||
}
|
||||
|
||||
html_logo = "../resources/static/img/pyrogram.png"
|
||||
html_logo = "../resources/static/img/pyrofork.png"
|
||||
html_favicon = "../resources/static/img/favicon.ico"
|
||||
|
||||
latex_engine = "xelatex"
|
||||
latex_logo = "../resources/static/img/pyrogram.png"
|
||||
latex_logo = "../resources/static/img/pyrofork.png"
|
||||
|
||||
latex_elements = {
|
||||
"pointsize": "12pt",
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ The following shows how to catch the exception in your code and wait the require
|
|||
.. code-block:: python
|
||||
|
||||
import asyncio
|
||||
from pyrogram.errors import FloodWait
|
||||
from pyrofork.errors import FloodWait
|
||||
|
||||
...
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ Welcome to Pyrofork
|
|||
|
||||
<div align="center">
|
||||
<a href="/">
|
||||
<h1 class="pyrogram-text pyrogram-text-index">PyroFork</h1>
|
||||
<h1 class="pyrofork-text pyrofork-text-index">Pyrofork</h1>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ Welcome to Pyrofork
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client, filters
|
||||
from pyrofork import Client, filters
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ If no error shows up you are good to go.
|
|||
|
||||
.. parsed-literal::
|
||||
|
||||
>>> import pyrogram
|
||||
>>> pyrogram.__version__
|
||||
>>> import pyrofork
|
||||
>>> pyrofork.__version__
|
||||
'x.y.z'
|
||||
|
||||
.. _`Github repo`: http://github.com/Mayuri-Chan/pyrofork
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ Get Pyrofork Real Fast
|
|||
.. code-block:: python
|
||||
|
||||
import asyncio
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
api_id = 12345
|
||||
api_hash = "0123456789abcdef0123456789abcdef"
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@ User Authorization
|
|||
|
||||
In order to use the API, Telegram requires that users be authorized via their phone numbers.
|
||||
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:
|
||||
:class:`~pyrofork.Client` class by passing to it a ``name`` of your choice (e.g.: "my_account") and call
|
||||
the :meth:`~pyrofork.Client.run` method:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
api_id = 12345
|
||||
api_hash = "0123456789abcdef0123456789abcdef"
|
||||
|
|
@ -63,7 +63,7 @@ after the session name, which will be ``my_bot.session`` for the example below.
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
api_id = 12345
|
||||
api_hash = "0123456789abcdef0123456789abcdef"
|
||||
|
|
@ -87,7 +87,7 @@ after the session name, which will be ``my_bot.session`` for the example below.
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_account")
|
||||
app.run()
|
||||
|
|
@ -6,7 +6,7 @@ Pyrofork errors all live inside the ``errors`` package:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import errors
|
||||
from pyrofork import errors
|
||||
|
||||
.. contents:: Contents
|
||||
:backlinks: none
|
||||
|
|
@ -23,7 +23,7 @@ This error is raised every time a method call against Telegram's API was unsucce
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram.errors import RPCError
|
||||
from pyrofork.errors import RPCError
|
||||
|
||||
.. warning::
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ provides categories of errors, which are named after the common HTTP errors and
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram.errors import BadRequest, Forbidden, ...
|
||||
from pyrofork.errors import BadRequest, Forbidden, ...
|
||||
|
||||
- :doc:`303 - SeeOther <../api/errors/see-other>`
|
||||
- :doc:`400 - BadRequest <../api/errors/bad-request>`
|
||||
|
|
@ -56,7 +56,7 @@ issue. For example:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram.errors import FloodWait
|
||||
from pyrofork.errors import FloodWait
|
||||
|
||||
These errors subclass directly from the category of errors they belong to, which in turn subclass from the father
|
||||
``RPCError``, thus building a class of error hierarchy such as this:
|
||||
|
|
@ -91,7 +91,7 @@ The value is stored in the ``value`` attribute of the exception object:
|
|||
.. code-block:: python
|
||||
|
||||
import asyncio
|
||||
from pyrogram.errors import FloodWait
|
||||
from pyrofork.errors import FloodWait
|
||||
|
||||
...
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ like send_audio(), send_document(), send_location(), etc...
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrogram.types import (ReplyKeyboardMarkup, InlineKeyboardMarkup,
|
||||
from pyrofork import Client
|
||||
from pyrofork.types import (ReplyKeyboardMarkup, InlineKeyboardMarkup,
|
||||
InlineKeyboardButton)
|
||||
|
||||
# Create a client using your bot token
|
||||
|
|
@ -53,11 +53,11 @@ like send_audio(), send_document(), send_location(), etc...
|
|||
[ # Second row
|
||||
InlineKeyboardButton( # Opens the inline interface
|
||||
"Choose chat",
|
||||
switch_inline_query="pyrogram"
|
||||
switch_inline_query="pyrofork"
|
||||
),
|
||||
InlineKeyboardButton( # Opens the inline interface in the current chat
|
||||
"Inline here",
|
||||
switch_inline_query_current_chat="pyrogram"
|
||||
switch_inline_query_current_chat="pyrofork"
|
||||
)
|
||||
]
|
||||
]
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ It uses the @on_callback_query decorator to register a CallbackQueryHandler.
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_bot", bot_token="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11")
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ It uses the ``@on_message`` decorator to register a ``MessageHandler`` and appli
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client, filters
|
||||
from pyrofork import Client, filters
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ This example shows how to get the full message history of a chat, starting from
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ This example shows how to get all the members of a chat.
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
# Target channel/supergroup
|
||||
TARGET = -100123456789
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ This example shows how to get the full dialogs list (as user).
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ This example demonstrates a basic API usage
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
# Create a new Client instance
|
||||
app = Client("my_account")
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ to give you a basic idea.
|
|||
:doc:`bot_keyboards`, "Send normal and inline keyboards using regular bots"
|
||||
:doc:`raw_updates`, "Handle raw updates (old, should be avoided)"
|
||||
|
||||
For more advanced examples, see https://snippets.pyrogram.org.
|
||||
For more advanced examples, see https://snippets.pyrofork.org.
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ inline_queries
|
|||
|
||||
This example shows how to handle inline queries.
|
||||
|
||||
Two results are generated when users invoke the bot inline mode, e.g.: @pyrogrambot hi.
|
||||
Two results are generated when users invoke the bot inline mode, e.g.: @pyroforkbot hi.
|
||||
It uses the @on_inline_query decorator to register an InlineQueryHandler.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrogram.types import (InlineQueryResultArticle, InputTextMessageContent,
|
||||
from pyrofork import Client
|
||||
from pyrofork.types import (InlineQueryResultArticle, InputTextMessageContent,
|
||||
InlineKeyboardMarkup, InlineKeyboardButton)
|
||||
|
||||
app = Client("my_bot", bot_token="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11")
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ This example shows how to handle raw updates.
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ This example shows how to query an inline bot (as user).
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
# Create a new Client
|
||||
app = Client("my_account")
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ to make it only work for specific messages in a specific chat.
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client, emoji, filters
|
||||
from pyrofork import Client, emoji, filters
|
||||
|
||||
# Target chat. Can also be a list of multiple chat ids/usernames
|
||||
TARGET = -100123456789
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Making API calls with Pyrofork is very simple. Here's a basic example we are goi
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ Step-by-step
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
#. Now instantiate a new Client object, "my_account" is a session name of your choice.
|
||||
|
||||
|
|
@ -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 Pyrofork's :meth:`~pyrogram.Client.run`
|
||||
#. Finally, we tell Python to schedule our ``main()`` async function by using Pyrofork's :meth:`~pyrofork.Client.run`
|
||||
method.
|
||||
|
||||
.. code-block:: python
|
||||
|
|
@ -66,15 +66,15 @@ Context Manager
|
|||
---------------
|
||||
|
||||
The ``async with`` statement starts a context manager, which is used as a shortcut for starting, executing and stopping
|
||||
the Client, asynchronously. It does so by automatically calling :meth:`~pyrogram.Client.start` and
|
||||
:meth:`~pyrogram.Client.stop` in a more convenient way which also gracefully stops the client, even in case of
|
||||
the Client, asynchronously. It does so by automatically calling :meth:`~pyrofork.Client.start` and
|
||||
:meth:`~pyrofork.Client.stop` in a more convenient way which also gracefully stops the client, even in case of
|
||||
unhandled exceptions in your code.
|
||||
|
||||
Below there's the same example as above, but without the use of the context manager:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
@ -90,14 +90,14 @@ Below there's the same example as above, but without the use of the context mana
|
|||
Using asyncio.run()
|
||||
-------------------
|
||||
|
||||
Alternatively to the :meth:`~pyrogram.Client.run` method, you can use Python's ``asyncio.run()`` to execute the main
|
||||
Alternatively to the :meth:`~pyrofork.Client.run` method, you can use Python's ``asyncio.run()`` to execute the main
|
||||
function, with one little caveat: the Client instance (and possibly other asyncio resources you are going to use) must
|
||||
be instantiated inside the main function.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import asyncio
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
|
||||
async def main():
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ Having the API key from the previous step in handy, we can now begin to configur
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
api_id = 12345
|
||||
api_hash = "0123456789abcdef0123456789abcdef"
|
||||
|
|
|
|||
|
|
@ -24,18 +24,18 @@ function will be called back by the framework and its body executed.
|
|||
Registering a Handler
|
||||
---------------------
|
||||
|
||||
To explain how handlers work let's examine the one which will be in charge for handling :class:`~pyrogram.types.Message`
|
||||
To explain how handlers work let's examine the one which will be in charge for handling :class:`~pyrofork.types.Message`
|
||||
updates coming from all around your chats. Every other kind of handler shares the same setup logic and you should not
|
||||
have troubles settings them up once you learn from this section.
|
||||
|
||||
Using Decorators
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
The most elegant way to register a message handler is by using the :meth:`~pyrogram.Client.on_message` decorator:
|
||||
The most elegant way to register a message handler is by using the :meth:`~pyrofork.Client.on_message` decorator:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
@ -50,20 +50,20 @@ The most elegant way to register a message handler is by using the :meth:`~pyrog
|
|||
The defined function ``my_handler``, which accepts the two arguments *(client, message)*, will be the function that gets
|
||||
executed every time a new message arrives.
|
||||
|
||||
In the last line we see again the :meth:`~pyrogram.Client.run` method, this time used without any argument.
|
||||
Its purpose here is simply to automatically :meth:`~pyrogram.Client.start`, keep the Client online so that it can listen
|
||||
for updates and :meth:`~pyrogram.Client.stop` it once you hit ``CTRL+C``.
|
||||
In the last line we see again the :meth:`~pyrofork.Client.run` method, this time used without any argument.
|
||||
Its purpose here is simply to automatically :meth:`~pyrofork.Client.start`, keep the Client online so that it can listen
|
||||
for updates and :meth:`~pyrofork.Client.stop` it once you hit ``CTRL+C``.
|
||||
|
||||
Using add_handler()
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The :meth:`~pyrogram.Client.add_handler` method takes any handler instance that wraps around your defined callback
|
||||
The :meth:`~pyrofork.Client.add_handler` method takes any handler instance that wraps around your defined callback
|
||||
function and registers it in your Client. It is useful in case you want to programmatically add handlers.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrogram.handlers import MessageHandler
|
||||
from pyrofork import Client
|
||||
from pyrofork.handlers import MessageHandler
|
||||
|
||||
|
||||
async def my_function(client, message):
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Telegram Raw API
|
|||
----------------
|
||||
|
||||
If you can't find a high-level method for your needs or if you want complete, low-level access to the whole
|
||||
Telegram API, you have to use the raw :mod:`~pyrogram.raw.functions` and :mod:`~pyrogram.raw.types`.
|
||||
Telegram API, you have to use the raw :mod:`~pyrofork.raw.functions` and :mod:`~pyrofork.raw.types`.
|
||||
|
||||
As already hinted, raw functions and types can be less convenient. This section will therefore explain some pitfalls to
|
||||
take into consideration when working with the raw API.
|
||||
|
|
@ -34,11 +34,11 @@ Unlike the :doc:`methods <../api/methods/index>` found in Pyrofork's API, which
|
|||
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>`
|
||||
live in their respective packages (and sub-packages): ``pyrogram.raw.functions``, ``pyrogram.raw.types``. They all exist
|
||||
live in their respective packages (and sub-packages): ``pyrofork.raw.functions``, ``pyrofork.raw.types``. They all exist
|
||||
as Python classes, meaning you need to create an instance of each every time you need them and fill them in with the
|
||||
correct values using named arguments.
|
||||
|
||||
Next, to actually invoke the raw function you have to use the :meth:`~pyrogram.Client.invoke` method provided by the
|
||||
Next, to actually invoke the raw function you have to use the :meth:`~pyrofork.Client.invoke` method provided by the
|
||||
Client class and pass the function object you created.
|
||||
|
||||
Here's some examples:
|
||||
|
|
@ -47,8 +47,8 @@ Here's some examples:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrogram.raw import functions
|
||||
from pyrofork import Client
|
||||
from pyrofork.raw import functions
|
||||
|
||||
async with Client("my_account") as app:
|
||||
await app.invoke(
|
||||
|
|
@ -62,8 +62,8 @@ Here's some examples:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrogram.raw import functions, types
|
||||
from pyrofork import Client
|
||||
from pyrofork.raw import functions, types
|
||||
|
||||
async with Client("my_account") as app:
|
||||
# Set online status
|
||||
|
|
@ -76,8 +76,8 @@ Here's some examples:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrogram.raw import functions, types
|
||||
from pyrofork import Client
|
||||
from pyrofork.raw import functions, types
|
||||
|
||||
async with Client("my_account") as app:
|
||||
r = await app.invoke(
|
||||
|
|
@ -98,12 +98,12 @@ sending messages with IDs only thanks to cached access hashes.
|
|||
There are three different InputPeer types, one for each kind of Telegram entity.
|
||||
Whenever an InputPeer is needed you must pass one of these:
|
||||
|
||||
- :class:`~pyrogram.raw.types.InputPeerUser` - Users
|
||||
- :class:`~pyrogram.raw.types.InputPeerChat` - Basic Chats
|
||||
- :class:`~pyrogram.raw.types.InputPeerChannel` - Channels & Supergroups
|
||||
- :class:`~pyrofork.raw.types.InputPeerUser` - Users
|
||||
- :class:`~pyrofork.raw.types.InputPeerChat` - Basic Chats
|
||||
- :class:`~pyrofork.raw.types.InputPeerChannel` - Channels & Supergroups
|
||||
|
||||
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
|
||||
:meth:`~pyrofork.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
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
Creating Filters
|
||||
================
|
||||
|
||||
Pyrofork 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:`~pyrofork.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>`.
|
||||
:meth:`filters.create() <pyrofork.filters.create>`.
|
||||
|
||||
.. contents:: Contents
|
||||
:backlinks: none
|
||||
|
|
@ -16,40 +16,40 @@ Custom Filters
|
|||
--------------
|
||||
|
||||
An example to demonstrate how custom filters work is to show how to create and use one for the
|
||||
:class:`~pyrogram.handlers.CallbackQueryHandler`. Note that callback queries updates are only received by bots as result
|
||||
:class:`~pyrofork.handlers.CallbackQueryHandler`. Note that callback queries updates are only received by bots as result
|
||||
of a user pressing an inline button attached to the bot's message; create and :doc:`authorize your bot <../start/auth>`,
|
||||
then send a message with an inline keyboard to yourself. This allows you to test your filter by pressing the inline
|
||||
button:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
||||
from pyrofork.types import InlineKeyboardMarkup, InlineKeyboardButton
|
||||
|
||||
await app.send_message(
|
||||
"username", # Change this to your username or id
|
||||
"Pyrofork custom filter test",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[[InlineKeyboardButton("Press me", "pyrogram")]]
|
||||
[[InlineKeyboardButton("Press me", "pyrofork")]]
|
||||
)
|
||||
)
|
||||
|
||||
Basic Filters
|
||||
-------------
|
||||
|
||||
For this basic filter we will be using only the first parameter of :meth:`~pyrogram.filters.create`.
|
||||
For this basic filter we will be using only the first parameter of :meth:`~pyrofork.filters.create`.
|
||||
|
||||
The heart of a filter is its callback function, which accepts three arguments *(self, client, update)* and returns
|
||||
either ``True``, in case you want the update to pass the filter or ``False`` otherwise.
|
||||
|
||||
In this example we are matching the query data to "pyrogram", which means that the filter will only allow callback
|
||||
queries containing "pyrogram" as data:
|
||||
In this example we are matching the query data to "pyrofork", which means that the filter will only allow callback
|
||||
queries containing "pyrofork" as data:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import filters
|
||||
from pyrofork import filters
|
||||
|
||||
async def func(_, __, query):
|
||||
return query.data == "pyrogram"
|
||||
return query.data == "pyrofork"
|
||||
|
||||
static_data_filter = filters.create(func)
|
||||
|
||||
|
|
@ -61,14 +61,14 @@ Finally, the filter usage remains the same:
|
|||
.. code-block:: python
|
||||
|
||||
@app.on_callback_query(static_data_filter)
|
||||
async def pyrogram_data(_, query):
|
||||
async def pyrofork_data(_, query):
|
||||
query.answer("it works!")
|
||||
|
||||
Filters with Arguments
|
||||
----------------------
|
||||
|
||||
A more flexible filter would be one that accepts "pyrogram" or any other string as argument at usage time.
|
||||
A dynamic filter like this will make use of named arguments for the :meth:`~pyrogram.filters.create` method and the
|
||||
A more flexible filter would be one that accepts "pyrofork" or any other string as argument at usage time.
|
||||
A dynamic filter like this will make use of named arguments for the :meth:`~pyrofork.filters.create` method and the
|
||||
first argument of the callback function, which is a reference to the filter object itself holding the extra data passed
|
||||
via named arguments.
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ This is how a dynamic custom filter looks like:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import filters
|
||||
from pyrofork import filters
|
||||
|
||||
def dynamic_data_filter(data):
|
||||
async def func(flt, _, query):
|
||||
|
|
@ -89,8 +89,8 @@ And finally its usage:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
@app.on_callback_query(dynamic_data_filter("pyrogram"))
|
||||
async def pyrogram_data(_, query):
|
||||
@app.on_callback_query(dynamic_data_filter("pyrofork"))
|
||||
async def pyrofork_data(_, query):
|
||||
query.answer("it works!")
|
||||
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ Method Calls Inside Filters
|
|||
---------------------------
|
||||
|
||||
The missing piece we haven't covered yet is the second argument of a filter callback function, namely, the ``client``
|
||||
argument. This is a reference to the :obj:`~pyrogram.Client` instance that is running the filter and it is useful in
|
||||
argument. This is a reference to the :obj:`~pyrofork.Client` instance that is running the filter and it is useful in
|
||||
case you would like to make some API calls before deciding whether the filter should allow the update or not:
|
||||
|
||||
.. code-block:: python
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ Consider the following code:
|
|||
me = await app.get_users("me")
|
||||
print(me) # User
|
||||
|
||||
This will show a JSON representation of the object returned by :meth:`~pyrogram.Client.get_users`, which is a
|
||||
:class:`~pyrogram.types.User` instance, in this case. The output on your terminal will be something similar to this:
|
||||
This will show a JSON representation of the object returned by :meth:`~pyrofork.Client.get_users`, which is a
|
||||
:class:`~pyrofork.types.User` instance, in this case. The output on your terminal will be something similar to this:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
|
|
@ -96,14 +96,14 @@ error. The correct way to get the object type is by using the built-in function
|
|||
|
||||
.. code-block:: text
|
||||
|
||||
<class 'pyrogram.types.UserStatus'>
|
||||
<class 'pyrofork.types.UserStatus'>
|
||||
|
||||
And to check if an object is an instance of a given class, you use the built-in function ``isinstance()``:
|
||||
|
||||
.. code-block:: python
|
||||
:name: this-py
|
||||
|
||||
from pyrogram.types import UserStatus
|
||||
from pyrofork.types import UserStatus
|
||||
|
||||
status = me.status
|
||||
print(isinstance(status, UserStatus))
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ Or, if you want ``just_text`` to be executed *before* ``text_or_sticker`` (note
|
|||
async def just_text(client, message):
|
||||
print("Just Text")
|
||||
|
||||
With :meth:`~pyrogram.Client.add_handler` (without decorators) the same can be achieved with:
|
||||
With :meth:`~pyrofork.Client.add_handler` (without decorators) the same can be achieved with:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ Example with ``raise StopPropagation``:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import StopPropagation
|
||||
from pyrofork import StopPropagation
|
||||
|
||||
@app.on_message(filters.private)
|
||||
async def _(client, message):
|
||||
|
|
@ -197,7 +197,7 @@ Example with ``raise ContinuePropagation``:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import ContinuePropagation
|
||||
from pyrofork import ContinuePropagation
|
||||
|
||||
@app.on_message(filters.private)
|
||||
async def _(client, message):
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ you can omit ``username`` and ``password``.
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
proxy = {
|
||||
"scheme": "socks5", # "socks4", "socks5" and "http" are supported
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ Asynchronously
|
|||
|
||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ Non-Asynchronously
|
|||
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
|
|||
|
|
@ -35,12 +35,12 @@ For Machines - repr(obj)
|
|||
|
||||
If you want to share or store objects for future references in a more compact way, you can use ``repr(obj)``. While
|
||||
still pretty much readable, this format is not intended for humans. The advantage of this format is that once you
|
||||
serialize your object, you can use ``eval()`` to get back the original structure; just make sure to ``import pyrogram``,
|
||||
serialize your object, you can use ``eval()`` to get back the original structure; just make sure to ``import pyrofork``,
|
||||
as the process requires the package to be in scope.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import pyrogram
|
||||
import pyrofork
|
||||
|
||||
...
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ after importing your modules, like this:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client, filters
|
||||
from pyrogram.handlers import MessageHandler
|
||||
from pyrofork import Client, filters
|
||||
from pyrofork.handlers import MessageHandler
|
||||
|
||||
from handlers import echo, echo_reversed
|
||||
|
||||
|
|
@ -72,8 +72,8 @@ after importing your modules, like this:
|
|||
app.run()
|
||||
|
||||
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:`~pyrogram.Client.add_handler` and manually instantiate each
|
||||
:class:`~pyrogram.handlers.MessageHandler` object because you can't use decorators for your functions.
|
||||
manually ``import``, manually :meth:`~pyrofork.Client.add_handler` and manually instantiate each
|
||||
:class:`~pyrofork.handlers.MessageHandler` object because you can't use decorators for your functions.
|
||||
So, what if you could? Smart Plugins solve this issue by taking care of handlers registration automatically.
|
||||
|
||||
Using Smart Plugins
|
||||
|
|
@ -100,7 +100,7 @@ Setting up your Pyrofork project to accommodate Smart Plugins is pretty straight
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client, filters
|
||||
from pyrofork import Client, filters
|
||||
|
||||
|
||||
@Client.on_message(filters.text & filters.private)
|
||||
|
|
@ -116,7 +116,7 @@ Setting up your Pyrofork project to accommodate Smart Plugins is pretty straight
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
plugins = dict(root="plugins")
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ Unloading
|
|||
^^^^^^^^^
|
||||
|
||||
In order to unload a plugin, all you need to do is obtain a reference to it by importing the relevant module and call
|
||||
:meth:`~pyrogram.Client.remove_handler` Client's method with your function's *handler* instance:
|
||||
:meth:`~pyrofork.Client.remove_handler` Client's method with your function's *handler* instance:
|
||||
|
||||
- ``main.py``
|
||||
|
||||
|
|
@ -290,7 +290,7 @@ Loading
|
|||
^^^^^^^
|
||||
|
||||
Similarly to the unloading process, in order to load again a previously unloaded plugin you do the same, but this time
|
||||
using :meth:`~pyrogram.Client.add_handler` instead. Example:
|
||||
using :meth:`~pyrofork.Client.add_handler` instead. Example:
|
||||
|
||||
- ``main.py``
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ Call ``uvloop.install()`` before calling ``asyncio.run()`` or ``app.run()``.
|
|||
import asyncio
|
||||
import uvloop
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
|
||||
async def main():
|
||||
|
|
@ -70,7 +70,7 @@ The ``uvloop.install()`` call also needs to be placed before creating a Client i
|
|||
.. code-block:: python
|
||||
|
||||
import uvloop
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
uvloop.install()
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ authorization process from scratch each time, Pyrofork needs to store the genera
|
|||
Different Storage Engines
|
||||
-------------------------
|
||||
|
||||
Pyrofork offers two different types of storage engines: a **File Storage** and a **Memory Storage**.
|
||||
Pyrofork offers three different types of storage engines: a **File Storage**, a **Memory Storage** and a **Mongodb Storage**.
|
||||
These engines are well integrated in the framework and require a minimal effort to set up. Here's how they work:
|
||||
|
||||
File Storage
|
||||
|
|
@ -32,11 +32,11 @@ The database will be saved to disk as a single portable file and is designed to
|
|||
data whenever they are needed.
|
||||
|
||||
To use this type of engine, simply pass any name of your choice to the ``name`` parameter of the
|
||||
:obj:`~pyrogram.Client` constructor, as usual:
|
||||
:obj:`~pyrofork.Client` constructor, as usual:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
async with Client("my_account") as app:
|
||||
print(await app.get_me())
|
||||
|
|
@ -49,11 +49,11 @@ Memory Storage
|
|||
^^^^^^^^^^^^^^
|
||||
|
||||
In case you don't want to have any session file saved to disk, you can use an in-memory storage by passing True to the
|
||||
``in_memory`` parameter of the :obj:`~pyrogram.Client` constructor:
|
||||
``in_memory`` parameter of the :obj:`~pyrofork.Client` constructor:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
async with Client("my_account", in_memory=True) as app:
|
||||
print(await app.get_me())
|
||||
|
|
@ -65,14 +65,14 @@ Mongodb Storage
|
|||
^^^^^^^^^^^^^^^
|
||||
|
||||
In case you want to have persistent session but you don't have persistent storage you can use mongodb storage by passing
|
||||
mongodb config as ``dict`` to the ``mongodb`` parameter of the :obj:`~pyrogram.Client` constructor:
|
||||
mongodb config as ``dict`` to the ``mongodb`` parameter of the :obj:`~pyrofork.Client` constructor:
|
||||
|
||||
Using async_pymongo (Recommended for python3.9+):
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from async_pymongo import AsyncClient
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
conn = AsyncClient("mongodb://...")
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ Using motor:
|
|||
.. code-block:: python
|
||||
|
||||
from motor.motor_asyncio import AsyncIOMotorClient
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
conn = AsyncIOMotorClient("mongodb://...")
|
||||
|
||||
|
|
@ -93,17 +93,17 @@ Using motor:
|
|||
print(await app.get_me())
|
||||
|
||||
This storage engine is backed by MongoDB, a session will be created and saved to mongodb database. Any subsequent client
|
||||
restart will make PyroFork search for a database named that way and the session database will be automatically loaded.
|
||||
restart will make Pyrofork search for a database named that way and the session database will be automatically loaded.
|
||||
|
||||
Session Strings
|
||||
---------------
|
||||
|
||||
In case you want to use an in-memory storage, but also want to keep access to the session you created, call
|
||||
:meth:`~pyrogram.Client.export_session_string` anytime before stopping the client...
|
||||
:meth:`~pyrofork.Client.export_session_string` anytime before stopping the client...
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
async with Client("my_account", in_memory=True) as app:
|
||||
print(await app.export_session_string())
|
||||
|
|
@ -113,7 +113,7 @@ login using the same session; the storage used will still be in-memory:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
session_string = "...ZnUIFD8jsjXTb8g_vpxx48k1zkov9sapD-tzjz-S4WZv70M..."
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ Pyrofork is being used inside the main function with its asynchronous interface.
|
|||
.. code-block:: python
|
||||
|
||||
import asyncio
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
|
||||
async def main():
|
||||
|
|
@ -48,7 +48,7 @@ As you can see, the non-async example becomes less cluttered.
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
@ -83,6 +83,6 @@ Pyrofork.
|
|||
import uvloop
|
||||
uvloop.install()
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
...
|
||||
|
|
@ -7,7 +7,7 @@ Telegram's test servers without hassle. All you need to do is start a new sessio
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrofork import Client
|
||||
|
||||
async with Client("my_account_test", test_mode=True) as app:
|
||||
print(await app.get_me())
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ list of the basic styles currently supported by Pyrofork.
|
|||
- :strike:`strike`
|
||||
- :underline:`underline`
|
||||
- spoiler
|
||||
- `text URL <https://pyrogram.org>`_
|
||||
- `text URL <https://pyrofork.org>`_
|
||||
- `user text mention <tg://user?id=123456789>`_
|
||||
- ``inline fixed-width code``
|
||||
- .. code-block:: text
|
||||
|
|
@ -47,8 +47,8 @@ list of the basic styles currently supported by Pyrofork.
|
|||
Markdown Style
|
||||
--------------
|
||||
|
||||
To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the *parse_mode* parameter when using
|
||||
:meth:`~pyrogram.Client.send_message`. Use the following syntax in your message:
|
||||
To strictly use this mode, pass :obj:`~pyrofork.enums.ParseMode.MARKDOWN` to the *parse_mode* parameter when using
|
||||
:meth:`~pyrofork.Client.send_message`. Use the following syntax in your message:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the
|
|||
|
||||
||spoiler||
|
||||
|
||||
[text URL](https://pyrogram.org/)
|
||||
[text URL](https://pyrofork.org/)
|
||||
|
||||
[text user mention](tg://user?id=123456789)
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import enums
|
||||
from pyrofork import enums
|
||||
|
||||
await app.send_message(
|
||||
"me",
|
||||
|
|
@ -90,7 +90,7 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the
|
|||
"--underline--, "
|
||||
"~~strike~~, "
|
||||
"||spoiler||, "
|
||||
"[URL](https://pyrogram.org), "
|
||||
"[URL](https://pyrofork.org), "
|
||||
"`code`, "
|
||||
"```"
|
||||
"for i in range(10):\n"
|
||||
|
|
@ -103,8 +103,8 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the
|
|||
HTML Style
|
||||
----------
|
||||
|
||||
To strictly use this mode, pass :obj:`~pyrogram.enums.HTML` to the *parse_mode* parameter when using
|
||||
:meth:`~pyrogram.Client.send_message`. The following tags are currently supported:
|
||||
To strictly use this mode, pass :obj:`~pyrofork.enums.HTML` to the *parse_mode* parameter when using
|
||||
:meth:`~pyrofork.Client.send_message`. The following tags are currently supported:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.HTML` to the *parse_mode*
|
|||
|
||||
<spoiler>spoiler</spoiler>
|
||||
|
||||
<a href="https://pyrogram.org/">text URL</a>
|
||||
<a href="https://pyrofork.org/">text URL</a>
|
||||
|
||||
<a href="tg://user?id=123456789">inline mention</a>
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.HTML` to the *parse_mode*
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import enums
|
||||
from pyrofork import enums
|
||||
|
||||
await app.send_message(
|
||||
"me",
|
||||
|
|
@ -148,7 +148,7 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.HTML` to the *parse_mode*
|
|||
"<u>underline</u>, "
|
||||
"<s>strike</s>, "
|
||||
"<spoiler>spoiler</spoiler>, "
|
||||
"<a href=\"https://pyrogram.org/\">URL</a>, "
|
||||
"<a href=\"https://pyrofork.org/\">URL</a>, "
|
||||
"<code>code</code>\n\n"
|
||||
"<pre>"
|
||||
"for i in range(10):\n"
|
||||
|
|
@ -193,11 +193,11 @@ Result:
|
|||
**bold**, *italic*
|
||||
|
||||
If you don't like this behaviour you can always choose to only enable either Markdown or HTML in strict mode by passing
|
||||
:obj:`~pyrogram.enums.MARKDOWN` or :obj:`~pyrogram.enums.HTML` as argument to the *parse_mode* parameter.
|
||||
:obj:`~pyrofork.enums.MARKDOWN` or :obj:`~pyrofork.enums.HTML` as argument to the *parse_mode* parameter.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import enums
|
||||
from pyrofork import enums
|
||||
|
||||
await app.send_message("me", "**bold**, <i>italic</i>", parse_mode=enums.ParseMode.MARKDOWN)
|
||||
await app.send_message("me", "**bold**, <i>italic</i>", parse_mode=enums.ParseMode.HTML)
|
||||
|
|
@ -208,12 +208,12 @@ Result:
|
|||
|
||||
\*\*bold**, *italic*
|
||||
|
||||
In case you want to completely turn off the style parser, simply pass :obj:`~pyrogram.enums.DISABLED` to *parse_mode*.
|
||||
In case you want to completely turn off the style parser, simply pass :obj:`~pyrofork.enums.DISABLED` to *parse_mode*.
|
||||
The text will be sent as-is.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import enums
|
||||
from pyrofork import enums
|
||||
|
||||
await app.send_message("me", "**bold**, <i>italic</i>", parse_mode=enums.ParseMode.DISABLED)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Using Filters
|
|||
So far we've seen :doc:`how to register a callback function <../start/updates>` that executes every time an update comes
|
||||
from the server, but there's much more than that to come.
|
||||
|
||||
Here we'll discuss about :obj:`~pyrogram.filters`. Filters enable a fine-grain control over what kind of
|
||||
Here we'll discuss about :obj:`~pyrofork.filters`. Filters enable a fine-grain control over what kind of
|
||||
updates are allowed or not to be passed in your callback functions, based on their inner details.
|
||||
|
||||
.. contents:: Contents
|
||||
|
|
@ -19,12 +19,12 @@ Single Filters
|
|||
|
||||
Let's start right away with a simple example:
|
||||
|
||||
- This example will show you how to **only** handle messages containing a :class:`~pyrogram.types.Sticker` object and
|
||||
- This example will show you how to **only** handle messages containing a :class:`~pyrofork.types.Sticker` object and
|
||||
ignore any other message. Filters are passed as the first argument of the decorator:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import filters
|
||||
from pyrofork import filters
|
||||
|
||||
|
||||
@app.on_message(filters.sticker)
|
||||
|
|
@ -36,8 +36,8 @@ Let's start right away with a simple example:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import filters
|
||||
from pyrogram.handlers import MessageHandler
|
||||
from pyrofork import filters
|
||||
from pyrofork.handlers import MessageHandler
|
||||
|
||||
|
||||
async def my_handler(client, message):
|
||||
|
|
@ -76,7 +76,7 @@ Here are some examples:
|
|||
Advanced Filters
|
||||
----------------
|
||||
|
||||
Some filters, like :meth:`~pyrogram.filters.command` or :meth:`~pyrogram.filters.regex`
|
||||
Some filters, like :meth:`~pyrofork.filters.command` or :meth:`~pyrofork.filters.regex`
|
||||
can also accept arguments:
|
||||
|
||||
- Message is either a */start* or */help* **command**.
|
||||
|
|
@ -91,7 +91,7 @@ can also accept arguments:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
@app.on_message(filters.regex("pyrogram"))
|
||||
@app.on_message(filters.regex("pyrofork"))
|
||||
async def my_handler(client, message):
|
||||
print(message)
|
||||
|
||||
|
|
@ -110,5 +110,5 @@ More handlers using different filters can also live together.
|
|||
|
||||
|
||||
@app.on_message(filters.chat("PyroforkChat"))
|
||||
async def from_pyrogramchat(client, message):
|
||||
async def from_pyroforkchat(client, message):
|
||||
print("New message in @PyroforkChat")
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ classifiers = [
|
|||
keywords = ["telegram chat messenger mtproto api client library python"]
|
||||
|
||||
[tool.hatch.version]
|
||||
path = "pyrogram/__init__.py"
|
||||
path = "pyrofork/__init__.py"
|
||||
|
||||
# Used to call hatch_build.py
|
||||
[tool.hatch.build.hooks.custom]
|
||||
|
|
@ -89,4 +89,4 @@ exclude = [
|
|||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
ignore-vcs = true
|
||||
packages = ["pyrogram"]
|
||||
packages = ["pyrofork"]
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@
|
|||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__fork_name__ = "PyroFork"
|
||||
__version__ = "2.3.17.post2"
|
||||
__version__ = "2.4.0"
|
||||
__license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)"
|
||||
__copyright__ = "Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>"
|
||||
|
||||
|
|
@ -35,30 +35,30 @@ from mimetypes import MimeTypes
|
|||
from pathlib import Path
|
||||
from typing import Union, List, Optional, Callable, AsyncGenerator
|
||||
|
||||
import pyrogram
|
||||
from pyrogram import __version__, __license__
|
||||
from pyrogram import enums
|
||||
from pyrogram import raw
|
||||
from pyrogram import utils
|
||||
from pyrogram.crypto import aes
|
||||
from pyrogram.errors import CDNFileHashMismatch
|
||||
from pyrogram.errors import (
|
||||
import pyrofork
|
||||
from pyrofork import __version__, __license__
|
||||
from pyrofork import enums
|
||||
from pyrofork import raw
|
||||
from pyrofork import utils
|
||||
from pyrofork.crypto import aes
|
||||
from pyrofork.errors import CDNFileHashMismatch
|
||||
from pyrofork.errors import (
|
||||
SessionPasswordNeeded,
|
||||
VolumeLocNotFound, ChannelPrivate,
|
||||
BadRequest
|
||||
)
|
||||
from pyrogram.handlers.handler import Handler
|
||||
from pyrogram.methods import Methods
|
||||
from pyrogram.session import Auth, Session
|
||||
from pyrogram.storage import FileStorage, MemoryStorage, Storage
|
||||
from pyrofork.handlers.handler import Handler
|
||||
from pyrofork.methods import Methods
|
||||
from pyrofork.session import Auth, Session
|
||||
from pyrofork.storage import FileStorage, MemoryStorage, Storage
|
||||
try:
|
||||
import pymongo
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
from pyrogram.storage import MongoStorage
|
||||
from pyrogram.types import User, TermsOfService
|
||||
from pyrogram.utils import ainput
|
||||
from pyrofork.storage import MongoStorage
|
||||
from pyrofork.types import User, TermsOfService
|
||||
from pyrofork.utils import ainput
|
||||
from .dispatcher import Dispatcher
|
||||
from .file_id import FileId, FileType, ThumbnailSource
|
||||
from .filters import Filter
|
||||
|
|
@ -70,7 +70,7 @@ log = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class Client(Methods):
|
||||
"""Pyrogram Client, the main means for interacting with Telegram.
|
||||
"""Pyrofork Client, the main means for interacting with Telegram.
|
||||
|
||||
Parameters:
|
||||
name (``str``):
|
||||
|
|
@ -86,7 +86,7 @@ class Client(Methods):
|
|||
|
||||
app_version (``str``, *optional*):
|
||||
Application version.
|
||||
Defaults to "Pyrogram x.y.z".
|
||||
Defaults to "Pyrofork x.y.z".
|
||||
|
||||
device_model (``str``, *optional*):
|
||||
Device model.
|
||||
|
|
@ -129,7 +129,7 @@ class Client(Methods):
|
|||
in_memory (``bool``, *optional*):
|
||||
Pass True to start an in-memory session that will be discarded as soon as the client stops.
|
||||
In order to reconnect again using an in-memory session without having to login again, you can use
|
||||
:meth:`~pyrogram.Client.export_session_string` before stopping the client to get a session string you can
|
||||
:meth:`~pyrofork.Client.export_session_string` before stopping the client to get a session string you can
|
||||
pass to the ``session_string`` parameter.
|
||||
Defaults to False.
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ class Client(Methods):
|
|||
Mongodb config as dict, e.g.: *dict(connection=async_pymongo.AsyncClient("mongodb://..."), remove_peers=False)*.
|
||||
Only applicable for new sessions.
|
||||
|
||||
storage (:obj:`~pyrogram.storage.Storage`, *optional*):
|
||||
storage (:obj:`~pyrofork.storage.Storage`, *optional*):
|
||||
Custom session storage.
|
||||
|
||||
phone_number (``str``, *optional*):
|
||||
|
|
@ -158,13 +158,13 @@ class Client(Methods):
|
|||
|
||||
workdir (``str``, *optional*):
|
||||
Define a custom working directory.
|
||||
The working directory is the location in the filesystem where Pyrogram will store the session files.
|
||||
The working directory is the location in the filesystem where Pyrofork will store the session files.
|
||||
Defaults to the parent directory of the main script.
|
||||
|
||||
plugins (``dict``, *optional*):
|
||||
Smart Plugins settings as dict, e.g.: *dict(root="plugins")*.
|
||||
|
||||
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
|
||||
parse_mode (:obj:`~pyrofork.enums.ParseMode`, *optional*):
|
||||
Set the global parse mode of the client. By default, texts are parsed using both Markdown and HTML styles.
|
||||
You can combine both syntaxes together.
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ class Client(Methods):
|
|||
Defaults to 1.
|
||||
"""
|
||||
|
||||
APP_VERSION = f"Pyrogram {__version__}"
|
||||
APP_VERSION = f"Pyrofork {__version__}"
|
||||
DEVICE_MODEL = f"{platform.python_implementation()} {platform.python_version()}"
|
||||
SYSTEM_VERSION = f"{platform.system()} {platform.release()}"
|
||||
|
||||
|
|
@ -332,7 +332,7 @@ class Client(Methods):
|
|||
self.updates_watchdog_task = None
|
||||
self.updates_watchdog_event = asyncio.Event()
|
||||
self.last_update_time = datetime.now()
|
||||
self.listeners = {listener_type: [] for listener_type in pyrogram.enums.ListenerTypes}
|
||||
self.listeners = {listener_type: [] for listener_type in pyrofork.enums.ListenerTypes}
|
||||
self.loop = asyncio.get_event_loop()
|
||||
|
||||
def __enter__(self):
|
||||
|
|
@ -369,8 +369,8 @@ class Client(Methods):
|
|||
if self.bot_token:
|
||||
return await self.sign_in_bot(self.bot_token)
|
||||
|
||||
print(f"Welcome to Pyrogram (version {__version__})")
|
||||
print(f"Pyrogram is free software and comes with ABSOLUTELY NO WARRANTY. Licensed\n"
|
||||
print(f"Welcome to Pyrofork (version {__version__})")
|
||||
print(f"Pyrofork is free software and comes with ABSOLUTELY NO WARRANTY. Licensed\n"
|
||||
f"under the terms of the {__license__}.\n")
|
||||
|
||||
while True:
|
||||
|
|
@ -490,14 +490,14 @@ class Client(Methods):
|
|||
global value by default.
|
||||
|
||||
Parameters:
|
||||
parse_mode (:obj:`~pyrogram.enums.ParseMode`):
|
||||
parse_mode (:obj:`~pyrofork.enums.ParseMode`):
|
||||
By default, texts are parsed using both Markdown and HTML styles.
|
||||
You can combine both syntaxes together.
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import enums
|
||||
from pyrofork import enums
|
||||
|
||||
# Default combined mode: Markdown + HTML
|
||||
await app.send_message("me", "1. **markdown** and <i>html</i>")
|
||||
|
|
@ -840,7 +840,7 @@ class Client(Methods):
|
|||
if isinstance(e, asyncio.CancelledError):
|
||||
raise e
|
||||
|
||||
if isinstance(e, pyrogram.errors.FloodWait):
|
||||
if isinstance(e, pyrofork.errors.FloodWait):
|
||||
raise e
|
||||
|
||||
return None
|
||||
|
|
@ -1063,9 +1063,9 @@ class Client(Methods):
|
|||
raise e
|
||||
finally:
|
||||
await cdn_session.stop()
|
||||
except pyrogram.StopTransmission:
|
||||
except pyrofork.StopTransmission:
|
||||
raise
|
||||
except pyrogram.errors.FloodWait:
|
||||
except pyrofork.errors.FloodWait:
|
||||
raise
|
||||
except Exception as e:
|
||||
log.exception(e)
|
||||
|
|
@ -1,19 +1,20 @@
|
|||
# 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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
from .connection import Connection
|
||||
|
|
@ -1,19 +1,20 @@
|
|||
# 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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
from .tcp import *
|
||||
|
|
@ -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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
from .tcp import TCP
|
||||
from .tcp_abridged import TCPAbridged
|
||||
|
|
@ -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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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 asyncio
|
||||
import ipaddress
|
||||
|
|
@ -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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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 logging
|
||||
from typing import Optional
|
||||
|
|
@ -1,27 +1,28 @@
|
|||
# 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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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 logging
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
import pyrogram
|
||||
from pyrogram.crypto import aes
|
||||
import pyrofork
|
||||
from pyrofork.crypto import aes
|
||||
from .tcp import TCP
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
@ -58,7 +59,7 @@ class TCPAbridgedO(TCP):
|
|||
async def send(self, data: bytes, *args):
|
||||
length = len(data) // 4
|
||||
data = (bytes([length]) if length <= 126 else b"\x7f" + length.to_bytes(3, "little")) + data
|
||||
payload = await self.loop.run_in_executor(pyrogram.crypto_executor, aes.ctr256_encrypt, data, *self.encrypt)
|
||||
payload = await self.loop.run_in_executor(pyrofork.crypto_executor, aes.ctr256_encrypt, data, *self.encrypt)
|
||||
|
||||
await super().send(payload)
|
||||
|
||||
|
|
@ -83,4 +84,4 @@ class TCPAbridgedO(TCP):
|
|||
if data is None:
|
||||
return None
|
||||
|
||||
return await self.loop.run_in_executor(pyrogram.crypto_executor, aes.ctr256_decrypt, data, *self.decrypt)
|
||||
return await self.loop.run_in_executor(pyrofork.crypto_executor, aes.ctr256_decrypt, data, *self.decrypt)
|
||||
|
|
@ -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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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 logging
|
||||
from binascii import crc32
|
||||
|
|
@ -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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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 logging
|
||||
from struct import pack, unpack
|
||||
|
|
@ -1,27 +1,28 @@
|
|||
# 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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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 logging
|
||||
import os
|
||||
from struct import pack, unpack
|
||||
from typing import Optional
|
||||
|
||||
from pyrogram.crypto import aes
|
||||
from pyrofork.crypto import aes
|
||||
from .tcp import TCP
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
@ -1,17 +1,18 @@
|
|||
# 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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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/>.
|
||||
|
|
@ -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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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 logging
|
||||
|
||||
|
|
@ -53,7 +54,7 @@ except ImportError:
|
|||
|
||||
log.warning(
|
||||
"TgCrypto is missing! "
|
||||
"Pyrogram will work the same, but at a much slower speed. "
|
||||
"Pyrofork will work the same, but at a much slower speed. "
|
||||
"More info: https://pyrofork.mayuri.my.id/topics/speedups"
|
||||
)
|
||||
|
||||
|
|
@ -1,27 +1,28 @@
|
|||
# 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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
from hashlib import sha256
|
||||
from io import BytesIO
|
||||
from os import urandom
|
||||
|
||||
from pyrogram.errors import SecurityCheckMismatch
|
||||
from pyrogram.raw.core import Message, Long
|
||||
from pyrofork.errors import SecurityCheckMismatch
|
||||
from pyrofork.raw.core import Message, Long
|
||||
from . import aes
|
||||
|
||||
|
||||
|
|
@ -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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
from random import randint
|
||||
|
||||
|
|
@ -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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
|
|
@ -22,12 +22,12 @@ import inspect
|
|||
import logging
|
||||
from collections import OrderedDict
|
||||
|
||||
import pyrogram
|
||||
from pyrogram import utils
|
||||
from pyrogram.handlers import (
|
||||
import pyrofork
|
||||
from pyrofork import utils
|
||||
from pyrofork.handlers import (
|
||||
CallbackQueryHandler, MessageHandler, EditedMessageHandler, DeletedMessagesHandler, MessageReactionUpdatedHandler, MessageReactionCountUpdatedHandler, UserStatusHandler, RawUpdateHandler, InlineQueryHandler, PollHandler, ConversationHandler, ChosenInlineResultHandler, ChatMemberUpdatedHandler, ChatJoinRequestHandler, StoryHandler
|
||||
)
|
||||
from pyrogram.raw.types import (
|
||||
from pyrofork.raw.types import (
|
||||
UpdateNewMessage, UpdateNewChannelMessage, UpdateNewScheduledMessage,
|
||||
UpdateEditMessage, UpdateEditChannelMessage,
|
||||
UpdateDeleteMessages, UpdateDeleteChannelMessages,
|
||||
|
|
@ -57,7 +57,7 @@ class Dispatcher:
|
|||
MESSAGE_BOT_NA_REACTION_UPDATES = (UpdateBotMessageReaction,)
|
||||
MESSAGE_BOT_A_REACTION_UPDATES = (UpdateBotMessageReactions,)
|
||||
|
||||
def __init__(self, client: "pyrogram.Client"):
|
||||
def __init__(self, client: "pyrofork.Client"):
|
||||
self.client = client
|
||||
self.loop = asyncio.get_event_loop()
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ class Dispatcher:
|
|||
|
||||
async def message_parser(update, users, chats):
|
||||
return (
|
||||
await pyrogram.types.Message._parse(self.client, update.message, users, chats,
|
||||
await pyrofork.types.Message._parse(self.client, update.message, users, chats,
|
||||
is_scheduled=isinstance(update, UpdateNewScheduledMessage)),
|
||||
MessageHandler
|
||||
)
|
||||
|
|
@ -94,61 +94,61 @@ class Dispatcher:
|
|||
|
||||
async def callback_query_parser(update, users, chats):
|
||||
return (
|
||||
await pyrogram.types.CallbackQuery._parse(self.client, update, users),
|
||||
await pyrofork.types.CallbackQuery._parse(self.client, update, users),
|
||||
CallbackQueryHandler
|
||||
)
|
||||
|
||||
async def user_status_parser(update, users, chats):
|
||||
return (
|
||||
pyrogram.types.User._parse_user_status(self.client, update),
|
||||
pyrofork.types.User._parse_user_status(self.client, update),
|
||||
UserStatusHandler
|
||||
)
|
||||
|
||||
async def inline_query_parser(update, users, chats):
|
||||
return (
|
||||
pyrogram.types.InlineQuery._parse(self.client, update, users),
|
||||
pyrofork.types.InlineQuery._parse(self.client, update, users),
|
||||
InlineQueryHandler
|
||||
)
|
||||
|
||||
async def poll_parser(update, users, chats):
|
||||
return (
|
||||
pyrogram.types.Poll._parse_update(self.client, update),
|
||||
pyrofork.types.Poll._parse_update(self.client, update),
|
||||
PollHandler
|
||||
)
|
||||
|
||||
async def chosen_inline_result_parser(update, users, chats):
|
||||
return (
|
||||
pyrogram.types.ChosenInlineResult._parse(self.client, update, users),
|
||||
pyrofork.types.ChosenInlineResult._parse(self.client, update, users),
|
||||
ChosenInlineResultHandler
|
||||
)
|
||||
|
||||
async def chat_member_updated_parser(update, users, chats):
|
||||
return (
|
||||
pyrogram.types.ChatMemberUpdated._parse(self.client, update, users, chats),
|
||||
pyrofork.types.ChatMemberUpdated._parse(self.client, update, users, chats),
|
||||
ChatMemberUpdatedHandler
|
||||
)
|
||||
|
||||
async def chat_join_request_parser(update, users, chats):
|
||||
return (
|
||||
pyrogram.types.ChatJoinRequest._parse(self.client, update, users, chats),
|
||||
pyrofork.types.ChatJoinRequest._parse(self.client, update, users, chats),
|
||||
ChatJoinRequestHandler
|
||||
)
|
||||
|
||||
async def story_parser(update, users, chats):
|
||||
return (
|
||||
await pyrogram.types.Story._parse(self.client, update.story, update.peer),
|
||||
await pyrofork.types.Story._parse(self.client, update.story, update.peer),
|
||||
StoryHandler
|
||||
)
|
||||
|
||||
async def message_bot_na_reaction_parser(update, users, chats):
|
||||
return (
|
||||
pyrogram.types.MessageReactionUpdated._parse(self.client, update, users, chats),
|
||||
pyrofork.types.MessageReactionUpdated._parse(self.client, update, users, chats),
|
||||
MessageReactionUpdatedHandler
|
||||
)
|
||||
|
||||
async def message_bot_a_reaction_parser(update, users, chats):
|
||||
return (
|
||||
pyrogram.types.MessageReactionCountUpdated._parse(self.client, update, users, chats),
|
||||
pyrofork.types.MessageReactionCountUpdated._parse(self.client, update, users, chats),
|
||||
MessageReactionCountUpdatedHandler
|
||||
)
|
||||
|
||||
|
|
@ -273,15 +273,15 @@ class Dispatcher:
|
|||
self.client,
|
||||
*args
|
||||
)
|
||||
except pyrogram.StopPropagation:
|
||||
except pyrofork.StopPropagation:
|
||||
raise
|
||||
except pyrogram.ContinuePropagation:
|
||||
except pyrofork.ContinuePropagation:
|
||||
continue
|
||||
except Exception as e:
|
||||
log.exception(e)
|
||||
|
||||
break
|
||||
except pyrogram.StopPropagation:
|
||||
except pyrofork.StopPropagation:
|
||||
pass
|
||||
except Exception as e:
|
||||
log.exception(e)
|
||||
|
|
@ -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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
GRINNING_FACE = "\U0001f600"
|
||||
GRINNING_FACE_WITH_BIG_EYES = "\U0001f603"
|
||||
|
|
@ -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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
from .chat_action import ChatAction
|
||||
from .chat_event_action import ChatEventAction
|
||||
|
|
@ -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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
from enum import Enum
|
||||
|
||||
|
|
@ -24,4 +25,4 @@ class AutoName(Enum):
|
|||
return self.lower()
|
||||
|
||||
def __repr__(self):
|
||||
return f"pyrogram.enums.{self}"
|
||||
return f"pyrofork.enums.{self}"
|
||||
|
|
@ -1,27 +1,28 @@
|
|||
# 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 Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
from pyrogram import raw
|
||||
from pyrofork import raw
|
||||
from .auto_name import AutoName
|
||||
|
||||
|
||||
class ChatAction(AutoName):
|
||||
"""Chat action enumeration used in :obj:`~pyrogram.types.ChatEvent`."""
|
||||
"""Chat action enumeration used in :obj:`~pyrofork.types.ChatEvent`."""
|
||||
|
||||
TYPING = raw.types.SendMessageTypingAction
|
||||
"Typing text message"
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue