mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-01 05:04:51 +00:00
Compare commits
7 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a16933aad | ||
|
|
ff305c92de | ||
|
|
ec114185c3 | ||
|
|
9ffab8b6d6 | ||
|
|
d1b41b0a3c | ||
|
|
afaf158183 | ||
|
|
8353e5a2a2 |
596 changed files with 5361 additions and 4879 deletions
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
|
@ -6,7 +6,7 @@ body:
|
||||||
label: Checklist
|
label: Checklist
|
||||||
description: Invalid, incomplete or inadequate issue reports may not be taken into consideration
|
description: Invalid, incomplete or inadequate issue reports may not be taken into consideration
|
||||||
options:
|
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
|
required: true
|
||||||
- label: I have searched in the issue tracker for similar bug reports, including closed ones
|
- label: I have searched in the issue tracker for similar bug reports, including closed ones
|
||||||
required: true
|
required: true
|
||||||
|
|
@ -37,7 +37,7 @@ body:
|
||||||
label: Code example
|
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)
|
description: Provide a [minimal, complete, consistently reproducible](https://stackoverflow.com/help/minimal-reproducible-example) and properly formatted example involving normal usages (if applicable)
|
||||||
placeholder: |
|
placeholder: |
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
...
|
...
|
||||||
render: python
|
render: python
|
||||||
|
|
||||||
|
|
|
||||||
12
.github/ISSUE_TEMPLATE/config.yml
vendored
12
.github/ISSUE_TEMPLATE/config.yml
vendored
|
|
@ -1,8 +1,8 @@
|
||||||
blank_issues_enabled: false
|
blank_issues_enabled: false
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: Ask Pyrogram related questions
|
- name: Ask Pyrofork related questions
|
||||||
url: https://stackoverflow.com/questions/tagged/pyrogram
|
url: https://stackoverflow.com/questions/tagged/pyrofork
|
||||||
about: This place is only for reporting issues about Pyrogram. You can ask questions at StackOverflow.
|
about: This place is only for reporting issues about Pyrofork. You can ask questions at StackOverflow.
|
||||||
- name: Join the Telegram channel
|
- name: Join the Telegram chat
|
||||||
url: https://t.me/pyrogram
|
url: https://t.me/MayuriChan_Chat
|
||||||
about: Join the official channel and stay tuned for news, updates and announcements.
|
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:
|
branches:
|
||||||
- staging
|
- staging
|
||||||
|
- dev/*
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
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]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
|
|
||||||
12
.gitignore
vendored
12
.gitignore
vendored
|
|
@ -6,12 +6,12 @@ main.py
|
||||||
unknown_errors.txt
|
unknown_errors.txt
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
# Pyrogram generated code
|
# Pyrofork generated code
|
||||||
pyrogram/errors/exceptions/
|
pyrofork/errors/exceptions/
|
||||||
pyrogram/raw/functions/
|
pyrofork/raw/functions/
|
||||||
pyrogram/raw/types/
|
pyrofork/raw/types/
|
||||||
pyrogram/raw/base/
|
pyrofork/raw/base/
|
||||||
pyrogram/raw/all.py
|
pyrofork/raw/all.py
|
||||||
docs/source/telegram
|
docs/source/telegram
|
||||||
docs/source/api/methods/
|
docs/source/api/methods/
|
||||||
docs/source/api/bound-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
|
recursive-include tests *.py
|
||||||
|
|
||||||
## Exclude
|
## Exclude
|
||||||
prune pyrogram/errors/exceptions
|
prune pyrofork/errors/exceptions
|
||||||
prune pyrogram/raw/functions
|
prune pyrofork/raw/functions
|
||||||
prune pyrogram/raw/types
|
prune pyrofork/raw/types
|
||||||
prune pyrogram/raw/base
|
prune pyrofork/raw/base
|
||||||
exclude pyrogram/raw/all.py
|
exclude pyrofork/raw/all.py
|
||||||
|
|
|
||||||
4
Makefile
4
Makefile
|
|
@ -1,7 +1,7 @@
|
||||||
VENV := venv
|
VENV := venv
|
||||||
PYTHON := $(VENV)/bin/python
|
PYTHON := $(VENV)/bin/python
|
||||||
HOST = $(shell ifconfig | grep "inet " | tail -1 | cut -d\ -f2)
|
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
|
RM := rm -rf
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@ clean-build:
|
||||||
$(RM) *.egg-info build dist
|
$(RM) *.egg-info build dist
|
||||||
|
|
||||||
clean-api:
|
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:
|
clean:
|
||||||
make clean-build
|
make clean-build
|
||||||
|
|
|
||||||
15
README.md
15
README.md
|
|
@ -1,10 +1,11 @@
|
||||||
<p align="center">
|
<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>
|
<br>
|
||||||
<b>Telegram MTProto API Framework for Python</b>
|
<b>Telegram MTProto API Framework for Python</b>
|
||||||
<br>
|
<br>
|
||||||
|
<a href="https://github.com/Mayuri-Chan">
|
||||||
|
Homepage
|
||||||
|
</a>
|
||||||
|
•
|
||||||
<a href="https://pyrofork.mayuri.my.id">
|
<a href="https://pyrofork.mayuri.my.id">
|
||||||
Documentation
|
Documentation
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -16,6 +17,10 @@
|
||||||
<a href="https://t.me/MayuriChan_Chat">
|
<a href="https://t.me/MayuriChan_Chat">
|
||||||
Support Chat
|
Support Chat
|
||||||
</a>
|
</a>
|
||||||
|
•
|
||||||
|
<a href="https://t.me/wulan17">
|
||||||
|
News/Releases
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Pyrofork
|
## Pyrofork
|
||||||
|
|
@ -23,7 +28,7 @@
|
||||||
> Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots
|
> Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots
|
||||||
|
|
||||||
``` python
|
``` python
|
||||||
from pyrogram import Client, filters
|
from pyrofork import Client, filters
|
||||||
|
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
|
|
||||||
|
|
@ -51,7 +56,7 @@ If you'd like to support Pyrofork, you can consider:
|
||||||
- **Ready**: Install Pyrofork with pip and start building your applications right away.
|
- **Ready**: Install Pyrofork with pip and start building your applications right away.
|
||||||
- **Easy**: Makes the Telegram API simple and intuitive, while still allowing advanced usages.
|
- **Easy**: Makes the Telegram API simple and intuitive, while still allowing advanced usages.
|
||||||
- **Elegant**: Low-level details are abstracted and re-presented in a more convenient way.
|
- **Elegant**: Low-level details are abstracted and re-presented in a more convenient way.
|
||||||
- **Fast**: Boosted up by [TgCrypto](https://github.com/pyrogram/tgcrypto), a high-performance cryptography library written in C.
|
- **Fast**: Boosted up by [TgCrypto](https://github.com/pyrogram/tgcrypto), a high-performance cryptography library written in C.
|
||||||
- **Type-hinted**: Types and methods are all type-hinted, enabling excellent editor support.
|
- **Type-hinted**: Types and methods are all type-hinted, enabling excellent editor support.
|
||||||
- **Async**: Fully asynchronous (also usable synchronously if wanted, for convenience).
|
- **Async**: Fully asynchronous (also usable synchronously if wanted, for convenience).
|
||||||
- **Powerful**: Full access to Telegram's API to execute any official client action and more.
|
- **Powerful**: Full access to Telegram's API to execute any official client action and more.
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,42 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export DOCS_KEY
|
export DOCS_KEY
|
||||||
export VENV=$(pwd)/venv
|
VENV="$(pwd)"/venv
|
||||||
|
export VENV
|
||||||
|
|
||||||
|
if [[ "$(echo "$GITHUB_REF" | cut -d '/' -f "1 2")" == "refs/tags" ]]; then
|
||||||
|
branch="main"
|
||||||
|
elif [[ "$GITHUB_REF" == "refs/heads/staging" ]]; then
|
||||||
|
branch="staging"
|
||||||
|
else
|
||||||
|
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
|
||||||
|
|
||||||
make clean
|
make clean
|
||||||
make clean-docs
|
make clean-docs
|
||||||
make venv
|
make venv
|
||||||
make api
|
make api
|
||||||
"$VENV"/bin/pip install -e '.[docs]'
|
"$VENV"/bin/pip install -e '.[docs]'
|
||||||
cd compiler/docs && "$VENV"/bin/python compiler.py
|
cd compiler/docs || exit 1 && "$VENV"/bin/python compiler.py
|
||||||
cd ../..
|
cd ../.. || exit 1
|
||||||
"$VENV"/bin/sphinx-build -b html "docs/source" "docs/build/html" -j auto
|
"$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
|
git clone https://wulan17:"$DOCS_KEY"@github.com/Mayuri-Chan/pyrofork-docs.git
|
||||||
cd pyrofork-docs
|
cd pyrofork-docs || exit 1
|
||||||
refs=$(echo "$GITHUB_REF" | cut -d '/' -f "1 2")
|
mkdir -p "$branch"
|
||||||
if [[ "$refs" == "refs/tags" ]]; then
|
cd "$branch" || exit 1
|
||||||
mkdir -p 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
|
||||||
cd main
|
cp -r ../../docs/build/html/* .
|
||||||
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/* .
|
|
||||||
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/* .
|
|
||||||
fi
|
|
||||||
git config --local user.name "Mayuri-Chan"
|
git config --local user.name "Mayuri-Chan"
|
||||||
git config --local user.email "mayuri@mayuri.my.id"
|
git config --local user.email "mayuri@mayuri.my.id"
|
||||||
git add --all
|
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
|
git push -u origin --all
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ from typing import NamedTuple, List, Tuple
|
||||||
# from black import format_str, FileMode
|
# from black import format_str, FileMode
|
||||||
|
|
||||||
HOME_PATH = Path("compiler/api")
|
HOME_PATH = Path("compiler/api")
|
||||||
DESTINATION_PATH = Path("pyrogram/raw")
|
DESTINATION_PATH = Path("pyrofork/raw")
|
||||||
NOTICE_PATH = "NOTICE"
|
NOTICE_PATH = "NOTICE"
|
||||||
|
|
||||||
SECTION_RE = re.compile(r"---(\w+)---")
|
SECTION_RE = re.compile(r"---(\w+)---")
|
||||||
|
|
@ -177,13 +177,13 @@ def get_docstring_arg_type(t: str):
|
||||||
else:
|
else:
|
||||||
return f"``{t.lower()}``"
|
return f"``{t.lower()}``"
|
||||||
elif t == "TLObject" or t == "X":
|
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":
|
elif t == "!X":
|
||||||
return "Any function from :obj:`~pyrogram.raw.functions`"
|
return "Any function from :obj:`~pyrofork.raw.functions`"
|
||||||
elif t.lower().startswith("vector"):
|
elif t.lower().startswith("vector"):
|
||||||
return "List of " + get_docstring_arg_type(t.split("<", 1)[1][:-1])
|
return "List of " + get_docstring_arg_type(t.split("<", 1)[1][:-1])
|
||||||
else:
|
else:
|
||||||
return f":obj:`{t} <pyrogram.raw.base.{t}>`"
|
return f":obj:`{t} <pyrofork.raw.base.{t}>`"
|
||||||
|
|
||||||
|
|
||||||
def get_references(t: str, kind: str):
|
def get_references(t: str, kind: str):
|
||||||
|
|
@ -340,7 +340,7 @@ def start(format: bool = False):
|
||||||
|
|
||||||
docstring += f"\n\n Constructors:\n" \
|
docstring += f"\n\n Constructors:\n" \
|
||||||
f" This base type has {constr_count} constructor{'s' if constr_count > 1 else ''} available.\n\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" .. autosummary::\n" \
|
||||||
f" :nosignatures:\n\n" \
|
f" :nosignatures:\n\n" \
|
||||||
f" {items}"
|
f" {items}"
|
||||||
|
|
@ -350,7 +350,7 @@ def start(format: bool = False):
|
||||||
if references:
|
if references:
|
||||||
docstring += f"\n\n Functions:\n This object can be returned by " \
|
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"{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" .. autosummary::\n" \
|
||||||
f" :nosignatures:\n\n" \
|
f" :nosignatures:\n\n" \
|
||||||
f" " + references
|
f" " + references
|
||||||
|
|
@ -423,7 +423,7 @@ def start(format: bool = False):
|
||||||
constructor_docs = "Telegram API type."
|
constructor_docs = "Telegram API type."
|
||||||
|
|
||||||
docstring += constructor_docs + "\n"
|
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:
|
else:
|
||||||
function_docs = docs["method"].get(c.qualname, None)
|
function_docs = docs["method"].get(c.qualname, None)
|
||||||
|
|
||||||
|
|
@ -444,7 +444,7 @@ def start(format: bool = False):
|
||||||
if references:
|
if references:
|
||||||
docstring += f"\n Functions:\n This object can be returned by " \
|
docstring += f"\n Functions:\n This object can be returned by " \
|
||||||
f"{count} function{'s' if count > 1 else ''}.\n\n" \
|
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" .. autosummary::\n" \
|
||||||
f" :nosignatures:\n\n" \
|
f" :nosignatures:\n\n" \
|
||||||
f" " + references
|
f" " + references
|
||||||
|
|
@ -634,23 +634,23 @@ def start(format: bool = False):
|
||||||
f.write("objects = {")
|
f.write("objects = {")
|
||||||
|
|
||||||
for c in combinators:
|
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 0xbc799737: "pyrofork.raw.core.BoolFalse",')
|
||||||
f.write('\n 0x997275b5: "pyrogram.raw.core.BoolTrue",')
|
f.write('\n 0x997275b5: "pyrofork.raw.core.BoolTrue",')
|
||||||
f.write('\n 0x1cb5c415: "pyrogram.raw.core.Vector",')
|
f.write('\n 0x1cb5c415: "pyrofork.raw.core.Vector",')
|
||||||
f.write('\n 0x73f1f8dc: "pyrogram.raw.core.MsgContainer",')
|
f.write('\n 0x73f1f8dc: "pyrofork.raw.core.MsgContainer",')
|
||||||
f.write('\n 0xae500895: "pyrogram.raw.core.FutureSalts",')
|
f.write('\n 0xae500895: "pyrofork.raw.core.FutureSalts",')
|
||||||
f.write('\n 0x0949d9dc: "pyrogram.raw.core.FutureSalt",')
|
f.write('\n 0x0949d9dc: "pyrofork.raw.core.FutureSalt",')
|
||||||
f.write('\n 0x3072cfa1: "pyrogram.raw.core.GzipPacked",')
|
f.write('\n 0x3072cfa1: "pyrofork.raw.core.GzipPacked",')
|
||||||
f.write('\n 0x5bb8e511: "pyrogram.raw.core.Message",')
|
f.write('\n 0x5bb8e511: "pyrofork.raw.core.Message",')
|
||||||
|
|
||||||
f.write("\n}\n")
|
f.write("\n}\n")
|
||||||
|
|
||||||
|
|
||||||
if "__main__" == __name__:
|
if "__main__" == __name__:
|
||||||
HOME_PATH = Path(".")
|
HOME_PATH = Path(".")
|
||||||
DESTINATION_PATH = Path("../../pyrogram/raw")
|
DESTINATION_PATH = Path("../../pyrofork/raw")
|
||||||
NOTICE_PATH = Path("../../NOTICE")
|
NOTICE_PATH = Path("../../NOTICE")
|
||||||
|
|
||||||
start(format=False)
|
start(format=False)
|
||||||
|
|
|
||||||
|
|
@ -1671,7 +1671,7 @@ invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X;
|
||||||
invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X;
|
invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X;
|
||||||
|
|
||||||
auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode;
|
auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode;
|
||||||
auth.signUp#80eee427 phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization;
|
auth.signUp#aac7b717 flags:# no_joined_notifications:flags.0?true phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization;
|
||||||
auth.signIn#8d52a951 flags:# phone_number:string phone_code_hash:string phone_code:flags.0?string email_verification:flags.1?EmailVerification = auth.Authorization;
|
auth.signIn#8d52a951 flags:# phone_number:string phone_code_hash:string phone_code:flags.0?string email_verification:flags.1?EmailVerification = auth.Authorization;
|
||||||
auth.logOut#3e72ba19 = auth.LoggedOut;
|
auth.logOut#3e72ba19 = auth.LoggedOut;
|
||||||
auth.resetAuthorizations#9fab0d1a = Bool;
|
auth.resetAuthorizations#9fab0d1a = Bool;
|
||||||
|
|
@ -2011,7 +2011,7 @@ messages.deleteSavedHistory#6e98102b flags:# peer:InputPeer max_id:int min_date:
|
||||||
messages.getPinnedSavedDialogs#d63d94e0 = messages.SavedDialogs;
|
messages.getPinnedSavedDialogs#d63d94e0 = messages.SavedDialogs;
|
||||||
messages.toggleSavedDialogPin#ac81bbde flags:# pinned:flags.0?true peer:InputDialogPeer = Bool;
|
messages.toggleSavedDialogPin#ac81bbde flags:# pinned:flags.0?true peer:InputDialogPeer = Bool;
|
||||||
messages.reorderPinnedSavedDialogs#8b716587 flags:# force:flags.0?true order:Vector<InputDialogPeer> = Bool;
|
messages.reorderPinnedSavedDialogs#8b716587 flags:# force:flags.0?true order:Vector<InputDialogPeer> = Bool;
|
||||||
messages.getSavedReactionTags#761ddacf hash:long = messages.SavedReactionTags;
|
messages.getSavedReactionTags#3637e05b flags:# peer:flags.0?InputPeer hash:long = messages.SavedReactionTags;
|
||||||
messages.updateSavedReactionTag#60297dec flags:# reaction:Reaction title:flags.0?string = Bool;
|
messages.updateSavedReactionTag#60297dec flags:# reaction:Reaction title:flags.0?string = Bool;
|
||||||
messages.getDefaultTagReactions#bdf93428 hash:long = messages.Reactions;
|
messages.getDefaultTagReactions#bdf93428 hash:long = messages.Reactions;
|
||||||
messages.getOutboxReadDate#8c4bfe5d peer:InputPeer msg_id:int = OutboxReadDate;
|
messages.getOutboxReadDate#8c4bfe5d peer:InputPeer msg_id:int = OutboxReadDate;
|
||||||
|
|
@ -2257,4 +2257,4 @@ premium.applyBoost#6b7da746 flags:# slots:flags.0?Vector<int> peer:InputPeer = p
|
||||||
premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus;
|
premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus;
|
||||||
premium.getUserBoosts#39854d1f peer:InputPeer user_id:InputUser = premium.BoostsList;
|
premium.getUserBoosts#39854d1f peer:InputPeer user_id:InputUser = premium.BoostsList;
|
||||||
|
|
||||||
// LAYER 172
|
// LAYER 173
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
|
from pyrofork.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
|
||||||
from pyrogram.raw.core import TLObject
|
from pyrofork.raw.core import TLObject
|
||||||
from pyrogram import raw
|
from pyrofork import raw
|
||||||
from typing import List, Optional, Any
|
from typing import List, Optional, Any
|
||||||
|
|
||||||
{warning}
|
{warning}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
{warning}
|
{warning}
|
||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from pyrogram import raw
|
from pyrofork import raw
|
||||||
from pyrogram.raw.core import TLObject
|
from pyrofork.raw.core import TLObject
|
||||||
|
|
||||||
{name} = Union[{types}]
|
{name} = Union[{types}]
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@ class {name}: # type: ignore
|
||||||
"""{docstring}
|
"""{docstring}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
QUALNAME = "pyrogram.raw.base.{qualname}"
|
QUALNAME = "pyrofork.raw.base.{qualname}"
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
raise TypeError("Base types can only be used for type checking purposes: "
|
raise TypeError("Base types can only be used for type checking purposes: "
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@ HOME = "compiler/docs"
|
||||||
DESTINATION = "docs/source/telegram"
|
DESTINATION = "docs/source/telegram"
|
||||||
PYROGRAM_API_DEST = "docs/source/api"
|
PYROGRAM_API_DEST = "docs/source/api"
|
||||||
|
|
||||||
FUNCTIONS_PATH = "pyrogram/raw/functions"
|
FUNCTIONS_PATH = "pyrofork/raw/functions"
|
||||||
TYPES_PATH = "pyrogram/raw/types"
|
TYPES_PATH = "pyrofork/raw/types"
|
||||||
BASE_PATH = "pyrogram/raw/base"
|
BASE_PATH = "pyrofork/raw/base"
|
||||||
|
|
||||||
FUNCTIONS_BASE = "functions"
|
FUNCTIONS_BASE = "functions"
|
||||||
TYPES_BASE = "types"
|
TYPES_BASE = "types"
|
||||||
|
|
@ -79,7 +79,7 @@ def generate(source_path, base):
|
||||||
page_template.format(
|
page_template.format(
|
||||||
title=full_name,
|
title=full_name,
|
||||||
title_markup="=" * len(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
|
".".join(full_path.split("/")[:-1]) + "." + name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -101,14 +101,14 @@ def generate(source_path, base):
|
||||||
|
|
||||||
if k != base:
|
if k != base:
|
||||||
inner_path = base + "/" + k + "/index" + ".rst"
|
inner_path = base + "/" + k + "/index" + ".rst"
|
||||||
module = "pyrogram.raw.{}.{}".format(base, k)
|
module = "pyrofork.raw.{}.{}".format(base, k)
|
||||||
else:
|
else:
|
||||||
for i in sorted(list(all_entities), reverse=True):
|
for i in sorted(list(all_entities), reverse=True):
|
||||||
if i != base:
|
if i != base:
|
||||||
entities.insert(0, "{0}/index".format(i))
|
entities.insert(0, "{0}/index".format(i))
|
||||||
|
|
||||||
inner_path = base + "/index" + ".rst"
|
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:
|
with open(DESTINATION + "/" + inner_path, "w", encoding="utf-8") as f:
|
||||||
if k == base:
|
if k == base:
|
||||||
|
|
@ -127,7 +127,7 @@ def generate(source_path, base):
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
|
|
||||||
|
|
||||||
def pyrogram_api():
|
def pyrofork_api():
|
||||||
def get_title_list(s: str) -> list:
|
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]
|
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)
|
title = "{}()".format(method)
|
||||||
|
|
||||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
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"]
|
functions = ["idle", "compose"]
|
||||||
|
|
||||||
|
|
@ -412,7 +412,7 @@ def pyrogram_api():
|
||||||
title = "{}()".format(func)
|
title = "{}()".format(func)
|
||||||
|
|
||||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
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))
|
f.write(template.format(**fmt_keys))
|
||||||
|
|
||||||
|
|
@ -615,7 +615,7 @@ def pyrogram_api():
|
||||||
title = "{}".format(type)
|
title = "{}".format(type)
|
||||||
|
|
||||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
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))
|
f.write(template.format(**fmt_keys))
|
||||||
|
|
||||||
|
|
@ -761,7 +761,7 @@ def pyrogram_api():
|
||||||
title = "{}()".format(bm)
|
title = "{}()".format(bm)
|
||||||
|
|
||||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
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))
|
f.write(template.format(**fmt_keys))
|
||||||
|
|
||||||
|
|
@ -781,13 +781,13 @@ def start():
|
||||||
generate(TYPES_PATH, TYPES_BASE)
|
generate(TYPES_PATH, TYPES_BASE)
|
||||||
generate(FUNCTIONS_PATH, FUNCTIONS_BASE)
|
generate(FUNCTIONS_PATH, FUNCTIONS_BASE)
|
||||||
generate(BASE_PATH, BASE_BASE)
|
generate(BASE_PATH, BASE_BASE)
|
||||||
pyrogram_api()
|
pyrofork_api()
|
||||||
|
|
||||||
|
|
||||||
if "__main__" == __name__:
|
if "__main__" == __name__:
|
||||||
FUNCTIONS_PATH = "../../pyrogram/raw/functions"
|
FUNCTIONS_PATH = "../../pyrofork/raw/functions"
|
||||||
TYPES_PATH = "../../pyrogram/raw/types"
|
TYPES_PATH = "../../pyrofork/raw/types"
|
||||||
BASE_PATH = "../../pyrogram/raw/base"
|
BASE_PATH = "../../pyrofork/raw/base"
|
||||||
HOME = "."
|
HOME = "."
|
||||||
DESTINATION = "../../docs/source/telegram"
|
DESTINATION = "../../docs/source/telegram"
|
||||||
PYROGRAM_API_DEST = "../../docs/source/api"
|
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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ some of the required arguments.
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
.. currentmodule:: pyrogram.types
|
.. currentmodule:: pyrofork.types
|
||||||
|
|
||||||
Message
|
Message
|
||||||
-------
|
-------
|
||||||
|
|
|
||||||
12
compiler/docs/template/methods.rst
vendored
12
compiler/docs/template/methods.rst
vendored
|
|
@ -1,13 +1,13 @@
|
||||||
Available Methods
|
Available Methods
|
||||||
=================
|
=================
|
||||||
|
|
||||||
This page is about Pyrofork methods. All the methods listed here are bound to a :class:`~pyrogram.Client` instance,
|
This page is about Pyrofork methods. All the methods listed here are bound to a :class:`~pyrofork.Client` instance,
|
||||||
except for :meth:`~pyrogram.idle()` and :meth:`~pyrogram.compose()`, which are special functions that can be found in
|
except for :meth:`~pyrofork.idle()` and :meth:`~pyrofork.compose()`, which are special functions that can be found in
|
||||||
the main package directly.
|
the main package directly.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ the main package directly.
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
.. currentmodule:: pyrogram.Client
|
.. currentmodule:: pyrofork.Client
|
||||||
|
|
||||||
Utilities
|
Utilities
|
||||||
---------
|
---------
|
||||||
|
|
@ -31,7 +31,7 @@ Utilities
|
||||||
|
|
||||||
{utilities}
|
{utilities}
|
||||||
|
|
||||||
.. currentmodule:: pyrogram
|
.. currentmodule:: pyrofork
|
||||||
|
|
||||||
.. autosummary::
|
.. autosummary::
|
||||||
:nosignatures:
|
:nosignatures:
|
||||||
|
|
@ -45,7 +45,7 @@ Utilities
|
||||||
idle
|
idle
|
||||||
compose
|
compose
|
||||||
|
|
||||||
.. currentmodule:: pyrogram.Client
|
.. currentmodule:: pyrofork.Client
|
||||||
|
|
||||||
Conversation
|
Conversation
|
||||||
------------
|
------------
|
||||||
|
|
|
||||||
6
compiler/docs/template/types.rst
vendored
6
compiler/docs/template/types.rst
vendored
|
|
@ -1,13 +1,13 @@
|
||||||
Available Types
|
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
|
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.
|
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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram.types import User, Message, ...
|
from pyrofork.types import User, Message, ...
|
||||||
|
|
||||||
.. note::
|
.. 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
|
Users & Chats
|
||||||
-------------
|
-------------
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import re
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
HOME = "compiler/errors"
|
HOME = "compiler/errors"
|
||||||
DEST = "pyrogram/errors/exceptions"
|
DEST = "pyrofork/errors/exceptions"
|
||||||
NOTICE_PATH = "NOTICE"
|
NOTICE_PATH = "NOTICE"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -137,7 +137,7 @@ def start():
|
||||||
|
|
||||||
if "__main__" == __name__:
|
if "__main__" == __name__:
|
||||||
HOME = "."
|
HOME = "."
|
||||||
DEST = "../../pyrogram/errors/exceptions"
|
DEST = "../../pyrofork/errors/exceptions"
|
||||||
NOTICE_PATH = "../../NOTICE"
|
NOTICE_PATH = "../../NOTICE"
|
||||||
|
|
||||||
start()
|
start()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ This page is about the Client class, which exposes high-level methods for an eas
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
|
|
||||||
|
|
@ -21,4 +21,4 @@ This page is about the Client class, which exposes high-level methods for an eas
|
||||||
Details
|
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
|
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
|
: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.
|
functions.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ functions.
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
.. currentmodule:: pyrogram
|
.. currentmodule:: pyrofork
|
||||||
|
|
||||||
Index
|
Index
|
||||||
-----
|
-----
|
||||||
|
|
@ -57,18 +57,18 @@ Details
|
||||||
-------
|
-------
|
||||||
|
|
||||||
.. Decorators
|
.. Decorators
|
||||||
.. autodecorator:: pyrogram.Client.on_message()
|
.. autodecorator:: pyrofork.Client.on_message()
|
||||||
.. autodecorator:: pyrogram.Client.on_edited_message()
|
.. autodecorator:: pyrofork.Client.on_edited_message()
|
||||||
.. autodecorator:: pyrogram.Client.on_callback_query()
|
.. autodecorator:: pyrofork.Client.on_callback_query()
|
||||||
.. autodecorator:: pyrogram.Client.on_message_reaction_updated()
|
.. autodecorator:: pyrofork.Client.on_message_reaction_updated()
|
||||||
.. autodecorator:: pyrogram.Client.on_message_reaction_count_updated()
|
.. autodecorator:: pyrofork.Client.on_message_reaction_count_updated()
|
||||||
.. autodecorator:: pyrogram.Client.on_inline_query()
|
.. autodecorator:: pyrofork.Client.on_inline_query()
|
||||||
.. autodecorator:: pyrogram.Client.on_chosen_inline_result()
|
.. autodecorator:: pyrofork.Client.on_chosen_inline_result()
|
||||||
.. autodecorator:: pyrogram.Client.on_chat_member_updated()
|
.. autodecorator:: pyrofork.Client.on_chat_member_updated()
|
||||||
.. autodecorator:: pyrogram.Client.on_chat_join_request()
|
.. autodecorator:: pyrofork.Client.on_chat_join_request()
|
||||||
.. autodecorator:: pyrogram.Client.on_deleted_messages()
|
.. autodecorator:: pyrofork.Client.on_deleted_messages()
|
||||||
.. autodecorator:: pyrogram.Client.on_user_status()
|
.. autodecorator:: pyrofork.Client.on_user_status()
|
||||||
.. autodecorator:: pyrogram.Client.on_story()
|
.. autodecorator:: pyrofork.Client.on_story()
|
||||||
.. autodecorator:: pyrogram.Client.on_poll()
|
.. autodecorator:: pyrofork.Client.on_poll()
|
||||||
.. autodecorator:: pyrogram.Client.on_disconnect()
|
.. autodecorator:: pyrofork.Client.on_disconnect()
|
||||||
.. autodecorator:: pyrogram.Client.on_raw_update()
|
.. autodecorator:: pyrofork.Client.on_raw_update()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
ChatAction
|
ChatAction
|
||||||
==========
|
==========
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.ChatAction()
|
.. autoclass:: pyrofork.enums.ChatAction()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
ChatEventAction
|
ChatEventAction
|
||||||
===============
|
===============
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.ChatEventAction()
|
.. autoclass:: pyrofork.enums.ChatEventAction()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
ChatMemberStatus
|
ChatMemberStatus
|
||||||
================
|
================
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.ChatMemberStatus()
|
.. autoclass:: pyrofork.enums.ChatMemberStatus()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
ChatMembersFilter
|
ChatMembersFilter
|
||||||
=================
|
=================
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.ChatMembersFilter()
|
.. autoclass:: pyrofork.enums.ChatMembersFilter()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
ChatType
|
ChatType
|
||||||
========
|
========
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.ChatType()
|
.. autoclass:: pyrofork.enums.ChatType()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
ListenerTypes
|
ListenerTypes
|
||||||
=============
|
=============
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.ListenerTypes()
|
.. autoclass:: pyrofork.enums.ListenerTypes()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
MessageEntityType
|
MessageEntityType
|
||||||
=================
|
=================
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.MessageEntityType()
|
.. autoclass:: pyrofork.enums.MessageEntityType()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
MessageMediaType
|
MessageMediaType
|
||||||
================
|
================
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.MessageMediaType()
|
.. autoclass:: pyrofork.enums.MessageMediaType()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
MessageServiceType
|
MessageServiceType
|
||||||
==================
|
==================
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.MessageServiceType()
|
.. autoclass:: pyrofork.enums.MessageServiceType()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
MessagesFilter
|
MessagesFilter
|
||||||
==============
|
==============
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.MessagesFilter()
|
.. autoclass:: pyrofork.enums.MessagesFilter()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
NextCodeType
|
NextCodeType
|
||||||
============
|
============
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.NextCodeType()
|
.. autoclass:: pyrofork.enums.NextCodeType()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
ParseMode
|
ParseMode
|
||||||
=========
|
=========
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.ParseMode()
|
.. autoclass:: pyrofork.enums.ParseMode()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
PollType
|
PollType
|
||||||
========
|
========
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.PollType()
|
.. autoclass:: pyrofork.enums.PollType()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
ReactionType
|
ReactionType
|
||||||
============
|
============
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.ReactionType()
|
.. autoclass:: pyrofork.enums.ReactionType()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
SentCodeType
|
SentCodeType
|
||||||
============
|
============
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.SentCodeType()
|
.. autoclass:: pyrofork.enums.SentCodeType()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
StoriesPrivacyRules
|
StoriesPrivacyRules
|
||||||
===================
|
===================
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.StoriesPrivacyRules()
|
.. autoclass:: pyrofork.enums.StoriesPrivacyRules()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
StoryPrivacy
|
StoryPrivacy
|
||||||
============
|
============
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.StoryPrivacy()
|
.. autoclass:: pyrofork.enums.StoryPrivacy()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
UserStatus
|
UserStatus
|
||||||
==========
|
==========
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.UserStatus()
|
.. autoclass:: pyrofork.enums.UserStatus()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ to apply only a valid value among the expected ones.
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
.. currentmodule:: pyrogram.enums
|
.. currentmodule:: pyrofork.enums
|
||||||
|
|
||||||
.. autosummary::
|
.. autosummary::
|
||||||
:nosignatures:
|
:nosignatures:
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
RPC Errors
|
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
|
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.
|
follow the usual *PascalCase* convention.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram.errors import FloodWait
|
from pyrofork.errors import FloodWait
|
||||||
|
|
||||||
try:
|
try:
|
||||||
...
|
...
|
||||||
|
|
|
||||||
|
|
@ -7,5 +7,5 @@ Filters are objects that can be used to filter the content of incoming updates.
|
||||||
Details
|
Details
|
||||||
-------
|
-------
|
||||||
|
|
||||||
.. automodule:: pyrogram.filters
|
.. automodule:: pyrofork.filters
|
||||||
:members:
|
:members:
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ For a much more convenient way of registering callback functions have a look at
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
from pyrogram.handlers import MessageHandler
|
from pyrofork.handlers import MessageHandler
|
||||||
|
|
||||||
app = Client("my_account")
|
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
|
Index
|
||||||
-----
|
-----
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import sys
|
||||||
|
|
||||||
sys.path.insert(0, os.path.abspath("../.."))
|
sys.path.insert(0, os.path.abspath("../.."))
|
||||||
|
|
||||||
from pyrogram import __version__
|
from pyrofork import __version__
|
||||||
|
|
||||||
from pygments.styles.friendly import FriendlyStyle
|
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"
|
html_favicon = "../resources/static/img/favicon.ico"
|
||||||
|
|
||||||
latex_engine = "xelatex"
|
latex_engine = "xelatex"
|
||||||
latex_logo = "../resources/static/img/pyrogram.png"
|
latex_logo = "../resources/static/img/pyrofork.png"
|
||||||
|
|
||||||
latex_elements = {
|
latex_elements = {
|
||||||
"pointsize": "12pt",
|
"pointsize": "12pt",
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ The following shows how to catch the exception in your code and wait the require
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from pyrogram.errors import FloodWait
|
from pyrofork.errors import FloodWait
|
||||||
|
|
||||||
...
|
...
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ Welcome to Pyrofork
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<a href="/">
|
<a href="/">
|
||||||
<h1 class="pyrogram-text pyrogram-text-index">PyroFork</h1>
|
<h1 class="pyrofork-text pyrofork-text-index">Pyrofork</h1>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -13,6 +13,10 @@ Welcome to Pyrofork
|
||||||
<b>Telegram MTProto API Framework for Python</b>
|
<b>Telegram MTProto API Framework for Python</b>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
<a href="https://github.com/Mayuri-Chan">
|
||||||
|
Homepage
|
||||||
|
</a>
|
||||||
|
•
|
||||||
<a href="https://github.com/Mayuri-Chan/pyrofork">
|
<a href="https://github.com/Mayuri-Chan/pyrofork">
|
||||||
Development
|
Development
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -24,11 +28,15 @@ Welcome to Pyrofork
|
||||||
<a href="https://t.me/MayuriChan_Chat">
|
<a href="https://t.me/MayuriChan_Chat">
|
||||||
Support Chat
|
Support Chat
|
||||||
</a>
|
</a>
|
||||||
|
•
|
||||||
|
<a href="https://t.me/wulan17">
|
||||||
|
News/Releases
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client, filters
|
from pyrofork import Client, filters
|
||||||
|
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ If no error shows up you are good to go.
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
>>> import pyrogram
|
>>> import pyrofork
|
||||||
>>> pyrogram.__version__
|
>>> pyrofork.__version__
|
||||||
'x.y.z'
|
'x.y.z'
|
||||||
|
|
||||||
.. _`Github repo`: http://github.com/Mayuri-Chan/pyrofork
|
.. _`Github repo`: http://github.com/Mayuri-Chan/pyrofork
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ Get Pyrofork Real Fast
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
api_id = 12345
|
api_id = 12345
|
||||||
api_hash = "0123456789abcdef0123456789abcdef"
|
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.
|
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
|
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
|
:class:`~pyrofork.Client` class by passing to it a ``name`` of your choice (e.g.: "my_account") and call
|
||||||
the :meth:`~pyrogram.Client.run` method:
|
the :meth:`~pyrofork.Client.run` method:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
api_id = 12345
|
api_id = 12345
|
||||||
api_hash = "0123456789abcdef0123456789abcdef"
|
api_hash = "0123456789abcdef0123456789abcdef"
|
||||||
|
|
@ -63,7 +63,7 @@ after the session name, which will be ``my_bot.session`` for the example below.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
api_id = 12345
|
api_id = 12345
|
||||||
api_hash = "0123456789abcdef0123456789abcdef"
|
api_hash = "0123456789abcdef0123456789abcdef"
|
||||||
|
|
@ -87,7 +87,7 @@ after the session name, which will be ``my_bot.session`` for the example below.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
app.run()
|
app.run()
|
||||||
|
|
@ -6,7 +6,7 @@ Pyrofork errors all live inside the ``errors`` package:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import errors
|
from pyrofork import errors
|
||||||
|
|
||||||
.. contents:: Contents
|
.. contents:: Contents
|
||||||
:backlinks: none
|
:backlinks: none
|
||||||
|
|
@ -23,7 +23,7 @@ This error is raised every time a method call against Telegram's API was unsucce
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram.errors import RPCError
|
from pyrofork.errors import RPCError
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ provides categories of errors, which are named after the common HTTP errors and
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram.errors import BadRequest, Forbidden, ...
|
from pyrofork.errors import BadRequest, Forbidden, ...
|
||||||
|
|
||||||
- :doc:`303 - SeeOther <../api/errors/see-other>`
|
- :doc:`303 - SeeOther <../api/errors/see-other>`
|
||||||
- :doc:`400 - BadRequest <../api/errors/bad-request>`
|
- :doc:`400 - BadRequest <../api/errors/bad-request>`
|
||||||
|
|
@ -56,7 +56,7 @@ issue. For example:
|
||||||
|
|
||||||
.. code-block:: python
|
.. 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
|
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:
|
``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
|
.. code-block:: python
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from pyrogram.errors import FloodWait
|
from pyrofork.errors import FloodWait
|
||||||
|
|
||||||
...
|
...
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ like send_audio(), send_document(), send_location(), etc...
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
from pyrogram.types import (ReplyKeyboardMarkup, InlineKeyboardMarkup,
|
from pyrofork.types import (ReplyKeyboardMarkup, InlineKeyboardMarkup,
|
||||||
InlineKeyboardButton)
|
InlineKeyboardButton)
|
||||||
|
|
||||||
# Create a client using your bot token
|
# Create a client using your bot token
|
||||||
|
|
@ -53,11 +53,11 @@ like send_audio(), send_document(), send_location(), etc...
|
||||||
[ # Second row
|
[ # Second row
|
||||||
InlineKeyboardButton( # Opens the inline interface
|
InlineKeyboardButton( # Opens the inline interface
|
||||||
"Choose chat",
|
"Choose chat",
|
||||||
switch_inline_query="pyrogram"
|
switch_inline_query="pyrofork"
|
||||||
),
|
),
|
||||||
InlineKeyboardButton( # Opens the inline interface in the current chat
|
InlineKeyboardButton( # Opens the inline interface in the current chat
|
||||||
"Inline here",
|
"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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_bot", bot_token="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11")
|
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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client, filters
|
from pyrofork import Client, filters
|
||||||
|
|
||||||
app = Client("my_account")
|
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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ This example shows how to get all the members of a chat.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
# Target channel/supergroup
|
# Target channel/supergroup
|
||||||
TARGET = -100123456789
|
TARGET = -100123456789
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ This example shows how to get the full dialogs list (as user).
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ This example demonstrates a basic API usage
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
# Create a new Client instance
|
# Create a new Client instance
|
||||||
app = Client("my_account")
|
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:`bot_keyboards`, "Send normal and inline keyboards using regular bots"
|
||||||
:doc:`raw_updates`, "Handle raw updates (old, should be avoided)"
|
: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::
|
.. toctree::
|
||||||
:hidden:
|
:hidden:
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@ inline_queries
|
||||||
|
|
||||||
This example shows how to handle 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.
|
It uses the @on_inline_query decorator to register an InlineQueryHandler.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
from pyrogram.types import (InlineQueryResultArticle, InputTextMessageContent,
|
from pyrofork.types import (InlineQueryResultArticle, InputTextMessageContent,
|
||||||
InlineKeyboardMarkup, InlineKeyboardButton)
|
InlineKeyboardMarkup, InlineKeyboardButton)
|
||||||
|
|
||||||
app = Client("my_bot", bot_token="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11")
|
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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ This example shows how to query an inline bot (as user).
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
# Create a new Client
|
# Create a new Client
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ to make it only work for specific messages in a specific chat.
|
||||||
|
|
||||||
.. code-block:: python
|
.. 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 chat. Can also be a list of multiple chat ids/usernames
|
||||||
TARGET = -100123456789
|
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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ Step-by-step
|
||||||
|
|
||||||
.. code-block:: python
|
.. 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.
|
#. 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:
|
async with app:
|
||||||
await app.send_message("me", "Hi!")
|
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.
|
method.
|
||||||
|
|
||||||
.. code-block:: python
|
.. 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 ``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
|
the Client, asynchronously. It does so by automatically calling :meth:`~pyrofork.Client.start` and
|
||||||
:meth:`~pyrogram.Client.stop` in a more convenient way which also gracefully stops the client, even in case of
|
:meth:`~pyrofork.Client.stop` in a more convenient way which also gracefully stops the client, even in case of
|
||||||
unhandled exceptions in your code.
|
unhandled exceptions in your code.
|
||||||
|
|
||||||
Below there's the same example as above, but without the use of the context manager:
|
Below there's the same example as above, but without the use of the context manager:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_account")
|
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()
|
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
|
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.
|
be instantiated inside the main function.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
api_id = 12345
|
api_id = 12345
|
||||||
api_hash = "0123456789abcdef0123456789abcdef"
|
api_hash = "0123456789abcdef0123456789abcdef"
|
||||||
|
|
|
||||||
|
|
@ -24,18 +24,18 @@ function will be called back by the framework and its body executed.
|
||||||
Registering a Handler
|
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
|
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.
|
have troubles settings them up once you learn from this section.
|
||||||
|
|
||||||
Using Decorators
|
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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_account")
|
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
|
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.
|
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.
|
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:`~pyrogram.Client.start`, keep the Client online so that it can listen
|
Its purpose here is simply to automatically :meth:`~pyrofork.Client.start`, keep the Client online so that it can listen
|
||||||
for updates and :meth:`~pyrogram.Client.stop` it once you hit ``CTRL+C``.
|
for updates and :meth:`~pyrofork.Client.stop` it once you hit ``CTRL+C``.
|
||||||
|
|
||||||
Using add_handler()
|
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.
|
function and registers it in your Client. It is useful in case you want to programmatically add handlers.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
from pyrogram.handlers import MessageHandler
|
from pyrofork.handlers import MessageHandler
|
||||||
|
|
||||||
|
|
||||||
async def my_function(client, message):
|
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
|
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
|
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.
|
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.
|
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>`
|
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
|
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.
|
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.
|
Client class and pass the function object you created.
|
||||||
|
|
||||||
Here's some examples:
|
Here's some examples:
|
||||||
|
|
@ -47,8 +47,8 @@ Here's some examples:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
from pyrogram.raw import functions
|
from pyrofork.raw import functions
|
||||||
|
|
||||||
async with Client("my_account") as app:
|
async with Client("my_account") as app:
|
||||||
await app.invoke(
|
await app.invoke(
|
||||||
|
|
@ -62,8 +62,8 @@ Here's some examples:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
from pyrogram.raw import functions, types
|
from pyrofork.raw import functions, types
|
||||||
|
|
||||||
async with Client("my_account") as app:
|
async with Client("my_account") as app:
|
||||||
# Set online status
|
# Set online status
|
||||||
|
|
@ -76,8 +76,8 @@ Here's some examples:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
from pyrogram.raw import functions, types
|
from pyrofork.raw import functions, types
|
||||||
|
|
||||||
async with Client("my_account") as app:
|
async with Client("my_account") as app:
|
||||||
r = await app.invoke(
|
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.
|
There are three different InputPeer types, one for each kind of Telegram entity.
|
||||||
Whenever an InputPeer is needed you must pass one of these:
|
Whenever an InputPeer is needed you must pass one of these:
|
||||||
|
|
||||||
- :class:`~pyrogram.raw.types.InputPeerUser` - Users
|
- :class:`~pyrofork.raw.types.InputPeerUser` - Users
|
||||||
- :class:`~pyrogram.raw.types.InputPeerChat` - Basic Chats
|
- :class:`~pyrofork.raw.types.InputPeerChat` - Basic Chats
|
||||||
- :class:`~pyrogram.raw.types.InputPeerChannel` - Channels & Supergroups
|
- :class:`~pyrofork.raw.types.InputPeerChannel` - Channels & Supergroups
|
||||||
|
|
||||||
But you don't necessarily have to manually instantiate each object because Pyrofork already provides
|
But you don't necessarily have to manually instantiate each object because Pyrofork already provides
|
||||||
:meth:`~pyrogram.Client.resolve_peer` as a convenience utility method that returns the correct InputPeer
|
:meth:`~pyrofork.Client.resolve_peer` as a convenience utility method that returns the correct InputPeer
|
||||||
by accepting a peer ID only.
|
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
|
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
|
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
|
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
|
.. contents:: Contents
|
||||||
:backlinks: none
|
: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
|
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>`,
|
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
|
then send a message with an inline keyboard to yourself. This allows you to test your filter by pressing the inline
|
||||||
button:
|
button:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
from pyrofork.types import InlineKeyboardMarkup, InlineKeyboardButton
|
||||||
|
|
||||||
await app.send_message(
|
await app.send_message(
|
||||||
"username", # Change this to your username or id
|
"username", # Change this to your username or id
|
||||||
"Pyrofork custom filter test",
|
"Pyrofork custom filter test",
|
||||||
reply_markup=InlineKeyboardMarkup(
|
reply_markup=InlineKeyboardMarkup(
|
||||||
[[InlineKeyboardButton("Press me", "pyrogram")]]
|
[[InlineKeyboardButton("Press me", "pyrofork")]]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
Basic Filters
|
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
|
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.
|
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
|
In this example we are matching the query data to "pyrofork", which means that the filter will only allow callback
|
||||||
queries containing "pyrogram" as data:
|
queries containing "pyrofork" as data:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import filters
|
from pyrofork import filters
|
||||||
|
|
||||||
async def func(_, __, query):
|
async def func(_, __, query):
|
||||||
return query.data == "pyrogram"
|
return query.data == "pyrofork"
|
||||||
|
|
||||||
static_data_filter = filters.create(func)
|
static_data_filter = filters.create(func)
|
||||||
|
|
||||||
|
|
@ -61,14 +61,14 @@ Finally, the filter usage remains the same:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@app.on_callback_query(static_data_filter)
|
@app.on_callback_query(static_data_filter)
|
||||||
async def pyrogram_data(_, query):
|
async def pyrofork_data(_, query):
|
||||||
query.answer("it works!")
|
query.answer("it works!")
|
||||||
|
|
||||||
Filters with Arguments
|
Filters with Arguments
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
A more flexible filter would be one that accepts "pyrogram" or any other string as argument at usage time.
|
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:`~pyrogram.filters.create` method and the
|
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
|
first argument of the callback function, which is a reference to the filter object itself holding the extra data passed
|
||||||
via named arguments.
|
via named arguments.
|
||||||
|
|
||||||
|
|
@ -76,7 +76,7 @@ This is how a dynamic custom filter looks like:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import filters
|
from pyrofork import filters
|
||||||
|
|
||||||
def dynamic_data_filter(data):
|
def dynamic_data_filter(data):
|
||||||
async def func(flt, _, query):
|
async def func(flt, _, query):
|
||||||
|
|
@ -89,8 +89,8 @@ And finally its usage:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@app.on_callback_query(dynamic_data_filter("pyrogram"))
|
@app.on_callback_query(dynamic_data_filter("pyrofork"))
|
||||||
async def pyrogram_data(_, query):
|
async def pyrofork_data(_, query):
|
||||||
query.answer("it works!")
|
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``
|
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:
|
case you would like to make some API calls before deciding whether the filter should allow the update or not:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ Consider the following code:
|
||||||
me = await app.get_users("me")
|
me = await app.get_users("me")
|
||||||
print(me) # User
|
print(me) # User
|
||||||
|
|
||||||
This will show a JSON representation of the object returned by :meth:`~pyrogram.Client.get_users`, which is a
|
This will show a JSON representation of the object returned by :meth:`~pyrofork.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:
|
:class:`~pyrofork.types.User` instance, in this case. The output on your terminal will be something similar to this:
|
||||||
|
|
||||||
.. code-block:: json
|
.. 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
|
.. 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()``:
|
And to check if an object is an instance of a given class, you use the built-in function ``isinstance()``:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
:name: this-py
|
:name: this-py
|
||||||
|
|
||||||
from pyrogram.types import UserStatus
|
from pyrofork.types import UserStatus
|
||||||
|
|
||||||
status = me.status
|
status = me.status
|
||||||
print(isinstance(status, UserStatus))
|
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):
|
async def just_text(client, message):
|
||||||
print("Just Text")
|
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
|
.. code-block:: python
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@ Example with ``raise StopPropagation``:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import StopPropagation
|
from pyrofork import StopPropagation
|
||||||
|
|
||||||
@app.on_message(filters.private)
|
@app.on_message(filters.private)
|
||||||
async def _(client, message):
|
async def _(client, message):
|
||||||
|
|
@ -197,7 +197,7 @@ Example with ``raise ContinuePropagation``:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import ContinuePropagation
|
from pyrofork import ContinuePropagation
|
||||||
|
|
||||||
@app.on_message(filters.private)
|
@app.on_message(filters.private)
|
||||||
async def _(client, message):
|
async def _(client, message):
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ you can omit ``username`` and ``password``.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
proxy = {
|
proxy = {
|
||||||
"scheme": "socks5", # "socks4", "socks5" and "http" are supported
|
"scheme": "socks5", # "socks4", "socks5" and "http" are supported
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ Asynchronously
|
||||||
|
|
||||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
|
|
||||||
|
|
@ -49,7 +49,7 @@ Non-Asynchronously
|
||||||
|
|
||||||
from apscheduler.schedulers.background import BackgroundScheduler
|
from apscheduler.schedulers.background import BackgroundScheduler
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_account")
|
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
|
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
|
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.
|
as the process requires the package to be in scope.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
import pyrogram
|
import pyrofork
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ after importing your modules, like this:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client, filters
|
from pyrofork import Client, filters
|
||||||
from pyrogram.handlers import MessageHandler
|
from pyrofork.handlers import MessageHandler
|
||||||
|
|
||||||
from handlers import echo, echo_reversed
|
from handlers import echo, echo_reversed
|
||||||
|
|
||||||
|
|
@ -72,8 +72,8 @@ after importing your modules, like this:
|
||||||
app.run()
|
app.run()
|
||||||
|
|
||||||
This is already nice and doesn't add *too much* boilerplate code, but things can get boring still; you have to
|
This is already nice and doesn't add *too much* boilerplate code, but things can get boring still; you have to
|
||||||
manually ``import``, manually :meth:`~pyrogram.Client.add_handler` and manually instantiate each
|
manually ``import``, manually :meth:`~pyrofork.Client.add_handler` and manually instantiate each
|
||||||
:class:`~pyrogram.handlers.MessageHandler` object because you can't use decorators for your functions.
|
: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.
|
So, what if you could? Smart Plugins solve this issue by taking care of handlers registration automatically.
|
||||||
|
|
||||||
Using Smart Plugins
|
Using Smart Plugins
|
||||||
|
|
@ -100,7 +100,7 @@ Setting up your Pyrofork project to accommodate Smart Plugins is pretty straight
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client, filters
|
from pyrofork import Client, filters
|
||||||
|
|
||||||
|
|
||||||
@Client.on_message(filters.text & filters.private)
|
@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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
plugins = dict(root="plugins")
|
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
|
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``
|
- ``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
|
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``
|
- ``main.py``
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ Call ``uvloop.install()`` before calling ``asyncio.run()`` or ``app.run()``.
|
||||||
import asyncio
|
import asyncio
|
||||||
import uvloop
|
import uvloop
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
|
|
@ -70,7 +70,7 @@ The ``uvloop.install()`` call also needs to be placed before creating a Client i
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
import uvloop
|
import uvloop
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
uvloop.install()
|
uvloop.install()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ authorization process from scratch each time, Pyrofork needs to store the genera
|
||||||
Different Storage Engines
|
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:
|
These engines are well integrated in the framework and require a minimal effort to set up. Here's how they work:
|
||||||
|
|
||||||
File Storage
|
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.
|
data whenever they are needed.
|
||||||
|
|
||||||
To use this type of engine, simply pass any name of your choice to the ``name`` parameter of the
|
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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
async with Client("my_account") as app:
|
async with Client("my_account") as app:
|
||||||
print(await app.get_me())
|
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 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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
async with Client("my_account", in_memory=True) as app:
|
async with Client("my_account", in_memory=True) as app:
|
||||||
print(await app.get_me())
|
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
|
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+):
|
Using async_pymongo (Recommended for python3.9+):
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from async_pymongo import AsyncClient
|
from async_pymongo import AsyncClient
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
conn = AsyncClient("mongodb://...")
|
conn = AsyncClient("mongodb://...")
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ Using motor:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from motor.motor_asyncio import AsyncIOMotorClient
|
from motor.motor_asyncio import AsyncIOMotorClient
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
conn = AsyncIOMotorClient("mongodb://...")
|
conn = AsyncIOMotorClient("mongodb://...")
|
||||||
|
|
||||||
|
|
@ -93,17 +93,17 @@ Using motor:
|
||||||
print(await app.get_me())
|
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
|
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
|
Session Strings
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
In case you want to use an in-memory storage, but also want to keep access to the session you created, call
|
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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
async with Client("my_account", in_memory=True) as app:
|
async with Client("my_account", in_memory=True) as app:
|
||||||
print(await app.export_session_string())
|
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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
session_string = "...ZnUIFD8jsjXTb8g_vpxx48k1zkov9sapD-tzjz-S4WZv70M..."
|
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
|
.. code-block:: python
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
|
|
@ -48,7 +48,7 @@ As you can see, the non-async example becomes less cluttered.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
|
|
||||||
|
|
@ -83,6 +83,6 @@ Pyrofork.
|
||||||
import uvloop
|
import uvloop
|
||||||
uvloop.install()
|
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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import Client
|
from pyrofork import Client
|
||||||
|
|
||||||
async with Client("my_account_test", test_mode=True) as app:
|
async with Client("my_account_test", test_mode=True) as app:
|
||||||
print(await app.get_me())
|
print(await app.get_me())
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ list of the basic styles currently supported by Pyrofork.
|
||||||
- :strike:`strike`
|
- :strike:`strike`
|
||||||
- :underline:`underline`
|
- :underline:`underline`
|
||||||
- spoiler
|
- spoiler
|
||||||
- `text URL <https://pyrogram.org>`_
|
- `text URL <https://pyrofork.org>`_
|
||||||
- `user text mention <tg://user?id=123456789>`_
|
- `user text mention <tg://user?id=123456789>`_
|
||||||
- ``inline fixed-width code``
|
- ``inline fixed-width code``
|
||||||
- .. code-block:: text
|
- .. code-block:: text
|
||||||
|
|
@ -47,8 +47,8 @@ list of the basic styles currently supported by Pyrofork.
|
||||||
Markdown Style
|
Markdown Style
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the *parse_mode* parameter when using
|
To strictly use this mode, pass :obj:`~pyrofork.enums.ParseMode.MARKDOWN` to the *parse_mode* parameter when using
|
||||||
:meth:`~pyrogram.Client.send_message`. Use the following syntax in your message:
|
:meth:`~pyrofork.Client.send_message`. Use the following syntax in your message:
|
||||||
|
|
||||||
.. code-block:: text
|
.. code-block:: text
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the
|
||||||
|
|
||||||
||spoiler||
|
||spoiler||
|
||||||
|
|
||||||
[text URL](https://pyrogram.org/)
|
[text URL](https://pyrofork.org/)
|
||||||
|
|
||||||
[text user mention](tg://user?id=123456789)
|
[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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import enums
|
from pyrofork import enums
|
||||||
|
|
||||||
await app.send_message(
|
await app.send_message(
|
||||||
"me",
|
"me",
|
||||||
|
|
@ -90,7 +90,7 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the
|
||||||
"--underline--, "
|
"--underline--, "
|
||||||
"~~strike~~, "
|
"~~strike~~, "
|
||||||
"||spoiler||, "
|
"||spoiler||, "
|
||||||
"[URL](https://pyrogram.org), "
|
"[URL](https://pyrofork.org), "
|
||||||
"`code`, "
|
"`code`, "
|
||||||
"```"
|
"```"
|
||||||
"for i in range(10):\n"
|
"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
|
HTML Style
|
||||||
----------
|
----------
|
||||||
|
|
||||||
To strictly use this mode, pass :obj:`~pyrogram.enums.HTML` to the *parse_mode* parameter when using
|
To strictly use this mode, pass :obj:`~pyrofork.enums.HTML` to the *parse_mode* parameter when using
|
||||||
:meth:`~pyrogram.Client.send_message`. The following tags are currently supported:
|
:meth:`~pyrofork.Client.send_message`. The following tags are currently supported:
|
||||||
|
|
||||||
.. code-block:: text
|
.. code-block:: text
|
||||||
|
|
||||||
|
|
@ -118,7 +118,7 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.HTML` to the *parse_mode*
|
||||||
|
|
||||||
<spoiler>spoiler</spoiler>
|
<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>
|
<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
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import enums
|
from pyrofork import enums
|
||||||
|
|
||||||
await app.send_message(
|
await app.send_message(
|
||||||
"me",
|
"me",
|
||||||
|
|
@ -148,7 +148,7 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.HTML` to the *parse_mode*
|
||||||
"<u>underline</u>, "
|
"<u>underline</u>, "
|
||||||
"<s>strike</s>, "
|
"<s>strike</s>, "
|
||||||
"<spoiler>spoiler</spoiler>, "
|
"<spoiler>spoiler</spoiler>, "
|
||||||
"<a href=\"https://pyrogram.org/\">URL</a>, "
|
"<a href=\"https://pyrofork.org/\">URL</a>, "
|
||||||
"<code>code</code>\n\n"
|
"<code>code</code>\n\n"
|
||||||
"<pre>"
|
"<pre>"
|
||||||
"for i in range(10):\n"
|
"for i in range(10):\n"
|
||||||
|
|
@ -193,11 +193,11 @@ Result:
|
||||||
**bold**, *italic*
|
**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
|
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
|
.. 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.MARKDOWN)
|
||||||
await app.send_message("me", "**bold**, <i>italic</i>", parse_mode=enums.ParseMode.HTML)
|
await app.send_message("me", "**bold**, <i>italic</i>", parse_mode=enums.ParseMode.HTML)
|
||||||
|
|
@ -208,12 +208,12 @@ Result:
|
||||||
|
|
||||||
\*\*bold**, *italic*
|
\*\*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.
|
The text will be sent as-is.
|
||||||
|
|
||||||
.. code-block:: python
|
.. 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)
|
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
|
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.
|
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.
|
updates are allowed or not to be passed in your callback functions, based on their inner details.
|
||||||
|
|
||||||
.. contents:: Contents
|
.. contents:: Contents
|
||||||
|
|
@ -19,12 +19,12 @@ Single Filters
|
||||||
|
|
||||||
Let's start right away with a simple example:
|
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:
|
ignore any other message. Filters are passed as the first argument of the decorator:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import filters
|
from pyrofork import filters
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.sticker)
|
@app.on_message(filters.sticker)
|
||||||
|
|
@ -36,8 +36,8 @@ Let's start right away with a simple example:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import filters
|
from pyrofork import filters
|
||||||
from pyrogram.handlers import MessageHandler
|
from pyrofork.handlers import MessageHandler
|
||||||
|
|
||||||
|
|
||||||
async def my_handler(client, message):
|
async def my_handler(client, message):
|
||||||
|
|
@ -76,7 +76,7 @@ Here are some examples:
|
||||||
Advanced Filters
|
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:
|
can also accept arguments:
|
||||||
|
|
||||||
- Message is either a */start* or */help* **command**.
|
- Message is either a */start* or */help* **command**.
|
||||||
|
|
@ -91,7 +91,7 @@ can also accept arguments:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@app.on_message(filters.regex("pyrogram"))
|
@app.on_message(filters.regex("pyrofork"))
|
||||||
async def my_handler(client, message):
|
async def my_handler(client, message):
|
||||||
print(message)
|
print(message)
|
||||||
|
|
||||||
|
|
@ -110,5 +110,5 @@ More handlers using different filters can also live together.
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.chat("PyroforkChat"))
|
@app.on_message(filters.chat("PyroforkChat"))
|
||||||
async def from_pyrogramchat(client, message):
|
async def from_pyroforkchat(client, message):
|
||||||
print("New message in @PyroforkChat")
|
print("New message in @PyroforkChat")
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,22 @@
|
||||||
|
# Pyrofork - Telegram MTProto API Client Library for Python
|
||||||
|
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
|
||||||
|
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||||
|
#
|
||||||
|
# This file is part of Pyrofork.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# 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 Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,13 @@ classifiers = [
|
||||||
keywords = ["telegram chat messenger mtproto api client library python"]
|
keywords = ["telegram chat messenger mtproto api client library python"]
|
||||||
|
|
||||||
[tool.hatch.version]
|
[tool.hatch.version]
|
||||||
path = "pyrogram/__init__.py"
|
path = "pyrofork/__init__.py"
|
||||||
|
|
||||||
# Used to call hatch_build.py
|
# Used to call hatch_build.py
|
||||||
[tool.hatch.build.hooks.custom]
|
[tool.hatch.build.hooks.custom]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
|
Homepage = "https://github.com/Mayuri-Chan"
|
||||||
Tracker = "https://github.com/Mayuri-Chan/pyrofork/issues"
|
Tracker = "https://github.com/Mayuri-Chan/pyrofork/issues"
|
||||||
Community = "https://t.me/MayuriChan_Chat"
|
Community = "https://t.me/MayuriChan_Chat"
|
||||||
Source = "https://github.com/Mayuri-Chan/pyrofork"
|
Source = "https://github.com/Mayuri-Chan/pyrofork"
|
||||||
|
|
@ -89,4 +90,4 @@ exclude = [
|
||||||
|
|
||||||
[tool.hatch.build.targets.wheel]
|
[tool.hatch.build.targets.wheel]
|
||||||
ignore-vcs = true
|
ignore-vcs = true
|
||||||
packages = ["pyrogram"]
|
packages = ["pyrofork"]
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,7 @@
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
__fork_name__ = "PyroFork"
|
__version__ = "2.4.0"
|
||||||
__version__ = "2.3.17.post2"
|
|
||||||
__license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)"
|
__license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)"
|
||||||
__copyright__ = "Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>"
|
__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 pathlib import Path
|
||||||
from typing import Union, List, Optional, Callable, AsyncGenerator
|
from typing import Union, List, Optional, Callable, AsyncGenerator
|
||||||
|
|
||||||
import pyrogram
|
import pyrofork
|
||||||
from pyrogram import __version__, __license__
|
from pyrofork import __version__, __license__
|
||||||
from pyrogram import enums
|
from pyrofork import enums
|
||||||
from pyrogram import raw
|
from pyrofork import raw
|
||||||
from pyrogram import utils
|
from pyrofork import utils
|
||||||
from pyrogram.crypto import aes
|
from pyrofork.crypto import aes
|
||||||
from pyrogram.errors import CDNFileHashMismatch
|
from pyrofork.errors import CDNFileHashMismatch
|
||||||
from pyrogram.errors import (
|
from pyrofork.errors import (
|
||||||
SessionPasswordNeeded,
|
SessionPasswordNeeded,
|
||||||
VolumeLocNotFound, ChannelPrivate,
|
VolumeLocNotFound, ChannelPrivate,
|
||||||
BadRequest
|
BadRequest
|
||||||
)
|
)
|
||||||
from pyrogram.handlers.handler import Handler
|
from pyrofork.handlers.handler import Handler
|
||||||
from pyrogram.methods import Methods
|
from pyrofork.methods import Methods
|
||||||
from pyrogram.session import Auth, Session
|
from pyrofork.session import Auth, Session
|
||||||
from pyrogram.storage import FileStorage, MemoryStorage, Storage
|
from pyrofork.storage import FileStorage, MemoryStorage, Storage
|
||||||
try:
|
try:
|
||||||
import pymongo
|
import pymongo
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
from pyrogram.storage import MongoStorage
|
from pyrofork.storage import MongoStorage
|
||||||
from pyrogram.types import User, TermsOfService
|
from pyrofork.types import User, TermsOfService
|
||||||
from pyrogram.utils import ainput
|
from pyrofork.utils import ainput
|
||||||
from .dispatcher import Dispatcher
|
from .dispatcher import Dispatcher
|
||||||
from .file_id import FileId, FileType, ThumbnailSource
|
from .file_id import FileId, FileType, ThumbnailSource
|
||||||
from .filters import Filter
|
from .filters import Filter
|
||||||
|
|
@ -70,7 +70,7 @@ log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Client(Methods):
|
class Client(Methods):
|
||||||
"""Pyrogram Client, the main means for interacting with Telegram.
|
"""Pyrofork Client, the main means for interacting with Telegram.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
name (``str``):
|
name (``str``):
|
||||||
|
|
@ -86,7 +86,7 @@ class Client(Methods):
|
||||||
|
|
||||||
app_version (``str``, *optional*):
|
app_version (``str``, *optional*):
|
||||||
Application version.
|
Application version.
|
||||||
Defaults to "Pyrogram x.y.z".
|
Defaults to "Pyrofork x.y.z".
|
||||||
|
|
||||||
device_model (``str``, *optional*):
|
device_model (``str``, *optional*):
|
||||||
Device model.
|
Device model.
|
||||||
|
|
@ -129,7 +129,7 @@ class Client(Methods):
|
||||||
in_memory (``bool``, *optional*):
|
in_memory (``bool``, *optional*):
|
||||||
Pass True to start an in-memory session that will be discarded as soon as the client stops.
|
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
|
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.
|
pass to the ``session_string`` parameter.
|
||||||
Defaults to False.
|
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)*.
|
Mongodb config as dict, e.g.: *dict(connection=async_pymongo.AsyncClient("mongodb://..."), remove_peers=False)*.
|
||||||
Only applicable for new sessions.
|
Only applicable for new sessions.
|
||||||
|
|
||||||
storage (:obj:`~pyrogram.storage.Storage`, *optional*):
|
storage (:obj:`~pyrofork.storage.Storage`, *optional*):
|
||||||
Custom session storage.
|
Custom session storage.
|
||||||
|
|
||||||
phone_number (``str``, *optional*):
|
phone_number (``str``, *optional*):
|
||||||
|
|
@ -158,13 +158,13 @@ class Client(Methods):
|
||||||
|
|
||||||
workdir (``str``, *optional*):
|
workdir (``str``, *optional*):
|
||||||
Define a custom working directory.
|
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.
|
Defaults to the parent directory of the main script.
|
||||||
|
|
||||||
plugins (``dict``, *optional*):
|
plugins (``dict``, *optional*):
|
||||||
Smart Plugins settings as dict, e.g.: *dict(root="plugins")*.
|
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.
|
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.
|
You can combine both syntaxes together.
|
||||||
|
|
||||||
|
|
@ -198,7 +198,7 @@ class Client(Methods):
|
||||||
Defaults to 1.
|
Defaults to 1.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
APP_VERSION = f"Pyrogram {__version__}"
|
APP_VERSION = f"Pyrofork {__version__}"
|
||||||
DEVICE_MODEL = f"{platform.python_implementation()} {platform.python_version()}"
|
DEVICE_MODEL = f"{platform.python_implementation()} {platform.python_version()}"
|
||||||
SYSTEM_VERSION = f"{platform.system()} {platform.release()}"
|
SYSTEM_VERSION = f"{platform.system()} {platform.release()}"
|
||||||
|
|
||||||
|
|
@ -332,7 +332,7 @@ class Client(Methods):
|
||||||
self.updates_watchdog_task = None
|
self.updates_watchdog_task = None
|
||||||
self.updates_watchdog_event = asyncio.Event()
|
self.updates_watchdog_event = asyncio.Event()
|
||||||
self.last_update_time = datetime.now()
|
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()
|
self.loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
|
|
@ -369,8 +369,8 @@ class Client(Methods):
|
||||||
if self.bot_token:
|
if self.bot_token:
|
||||||
return await self.sign_in_bot(self.bot_token)
|
return await self.sign_in_bot(self.bot_token)
|
||||||
|
|
||||||
print(f"Welcome to Pyrogram (version {__version__})")
|
print(f"Welcome to Pyrofork (version {__version__})")
|
||||||
print(f"Pyrogram is free software and comes with ABSOLUTELY NO WARRANTY. Licensed\n"
|
print(f"Pyrofork is free software and comes with ABSOLUTELY NO WARRANTY. Licensed\n"
|
||||||
f"under the terms of the {__license__}.\n")
|
f"under the terms of the {__license__}.\n")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
@ -490,14 +490,14 @@ class Client(Methods):
|
||||||
global value by default.
|
global value by default.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
parse_mode (:obj:`~pyrogram.enums.ParseMode`):
|
parse_mode (:obj:`~pyrofork.enums.ParseMode`):
|
||||||
By default, texts are parsed using both Markdown and HTML styles.
|
By default, texts are parsed using both Markdown and HTML styles.
|
||||||
You can combine both syntaxes together.
|
You can combine both syntaxes together.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from pyrogram import enums
|
from pyrofork import enums
|
||||||
|
|
||||||
# Default combined mode: Markdown + HTML
|
# Default combined mode: Markdown + HTML
|
||||||
await app.send_message("me", "1. **markdown** and <i>html</i>")
|
await app.send_message("me", "1. **markdown** and <i>html</i>")
|
||||||
|
|
@ -840,7 +840,7 @@ class Client(Methods):
|
||||||
if isinstance(e, asyncio.CancelledError):
|
if isinstance(e, asyncio.CancelledError):
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
if isinstance(e, pyrogram.errors.FloodWait):
|
if isinstance(e, pyrofork.errors.FloodWait):
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
@ -1063,9 +1063,9 @@ class Client(Methods):
|
||||||
raise e
|
raise e
|
||||||
finally:
|
finally:
|
||||||
await cdn_session.stop()
|
await cdn_session.stop()
|
||||||
except pyrogram.StopTransmission:
|
except pyrofork.StopTransmission:
|
||||||
raise
|
raise
|
||||||
except pyrogram.errors.FloodWait:
|
except pyrofork.errors.FloodWait:
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception(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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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
|
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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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 *
|
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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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 import TCP
|
||||||
from .tcp_abridged import TCPAbridged
|
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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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 asyncio
|
||||||
import ipaddress
|
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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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 logging
|
||||||
from typing import Optional
|
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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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 logging
|
||||||
import os
|
import os
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import pyrogram
|
import pyrofork
|
||||||
from pyrogram.crypto import aes
|
from pyrofork.crypto import aes
|
||||||
from .tcp import TCP
|
from .tcp import TCP
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
@ -58,7 +59,7 @@ class TCPAbridgedO(TCP):
|
||||||
async def send(self, data: bytes, *args):
|
async def send(self, data: bytes, *args):
|
||||||
length = len(data) // 4
|
length = len(data) // 4
|
||||||
data = (bytes([length]) if length <= 126 else b"\x7f" + length.to_bytes(3, "little")) + data
|
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)
|
await super().send(payload)
|
||||||
|
|
||||||
|
|
@ -83,4 +84,4 @@ class TCPAbridgedO(TCP):
|
||||||
if data is None:
|
if data is None:
|
||||||
return 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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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 logging
|
||||||
from binascii import crc32
|
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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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 logging
|
||||||
from struct import pack, unpack
|
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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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 logging
|
||||||
import os
|
import os
|
||||||
from struct import pack, unpack
|
from struct import pack, unpack
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from pyrogram.crypto import aes
|
from pyrofork.crypto import aes
|
||||||
from .tcp import TCP
|
from .tcp import TCP
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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 logging
|
||||||
|
|
||||||
|
|
@ -53,7 +54,7 @@ except ImportError:
|
||||||
|
|
||||||
log.warning(
|
log.warning(
|
||||||
"TgCrypto is missing! "
|
"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"
|
"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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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 hashlib import sha256
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from os import urandom
|
from os import urandom
|
||||||
|
|
||||||
from pyrogram.errors import SecurityCheckMismatch
|
from pyrofork.errors import SecurityCheckMismatch
|
||||||
from pyrogram.raw.core import Message, Long
|
from pyrofork.raw.core import Message, Long
|
||||||
from . import aes
|
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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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
|
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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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
|
from collections import namedtuple
|
||||||
|
|
||||||
|
|
@ -22,12 +22,12 @@ import inspect
|
||||||
import logging
|
import logging
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
import pyrogram
|
import pyrofork
|
||||||
from pyrogram import utils
|
from pyrofork import utils
|
||||||
from pyrogram.handlers import (
|
from pyrofork.handlers import (
|
||||||
CallbackQueryHandler, MessageHandler, EditedMessageHandler, DeletedMessagesHandler, MessageReactionUpdatedHandler, MessageReactionCountUpdatedHandler, UserStatusHandler, RawUpdateHandler, InlineQueryHandler, PollHandler, ConversationHandler, ChosenInlineResultHandler, ChatMemberUpdatedHandler, ChatJoinRequestHandler, StoryHandler
|
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,
|
UpdateNewMessage, UpdateNewChannelMessage, UpdateNewScheduledMessage,
|
||||||
UpdateEditMessage, UpdateEditChannelMessage,
|
UpdateEditMessage, UpdateEditChannelMessage,
|
||||||
UpdateDeleteMessages, UpdateDeleteChannelMessages,
|
UpdateDeleteMessages, UpdateDeleteChannelMessages,
|
||||||
|
|
@ -57,7 +57,7 @@ class Dispatcher:
|
||||||
MESSAGE_BOT_NA_REACTION_UPDATES = (UpdateBotMessageReaction,)
|
MESSAGE_BOT_NA_REACTION_UPDATES = (UpdateBotMessageReaction,)
|
||||||
MESSAGE_BOT_A_REACTION_UPDATES = (UpdateBotMessageReactions,)
|
MESSAGE_BOT_A_REACTION_UPDATES = (UpdateBotMessageReactions,)
|
||||||
|
|
||||||
def __init__(self, client: "pyrogram.Client"):
|
def __init__(self, client: "pyrofork.Client"):
|
||||||
self.client = client
|
self.client = client
|
||||||
self.loop = asyncio.get_event_loop()
|
self.loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ class Dispatcher:
|
||||||
|
|
||||||
async def message_parser(update, users, chats):
|
async def message_parser(update, users, chats):
|
||||||
return (
|
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)),
|
is_scheduled=isinstance(update, UpdateNewScheduledMessage)),
|
||||||
MessageHandler
|
MessageHandler
|
||||||
)
|
)
|
||||||
|
|
@ -94,61 +94,61 @@ class Dispatcher:
|
||||||
|
|
||||||
async def callback_query_parser(update, users, chats):
|
async def callback_query_parser(update, users, chats):
|
||||||
return (
|
return (
|
||||||
await pyrogram.types.CallbackQuery._parse(self.client, update, users),
|
await pyrofork.types.CallbackQuery._parse(self.client, update, users),
|
||||||
CallbackQueryHandler
|
CallbackQueryHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
async def user_status_parser(update, users, chats):
|
async def user_status_parser(update, users, chats):
|
||||||
return (
|
return (
|
||||||
pyrogram.types.User._parse_user_status(self.client, update),
|
pyrofork.types.User._parse_user_status(self.client, update),
|
||||||
UserStatusHandler
|
UserStatusHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
async def inline_query_parser(update, users, chats):
|
async def inline_query_parser(update, users, chats):
|
||||||
return (
|
return (
|
||||||
pyrogram.types.InlineQuery._parse(self.client, update, users),
|
pyrofork.types.InlineQuery._parse(self.client, update, users),
|
||||||
InlineQueryHandler
|
InlineQueryHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
async def poll_parser(update, users, chats):
|
async def poll_parser(update, users, chats):
|
||||||
return (
|
return (
|
||||||
pyrogram.types.Poll._parse_update(self.client, update),
|
pyrofork.types.Poll._parse_update(self.client, update),
|
||||||
PollHandler
|
PollHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
async def chosen_inline_result_parser(update, users, chats):
|
async def chosen_inline_result_parser(update, users, chats):
|
||||||
return (
|
return (
|
||||||
pyrogram.types.ChosenInlineResult._parse(self.client, update, users),
|
pyrofork.types.ChosenInlineResult._parse(self.client, update, users),
|
||||||
ChosenInlineResultHandler
|
ChosenInlineResultHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
async def chat_member_updated_parser(update, users, chats):
|
async def chat_member_updated_parser(update, users, chats):
|
||||||
return (
|
return (
|
||||||
pyrogram.types.ChatMemberUpdated._parse(self.client, update, users, chats),
|
pyrofork.types.ChatMemberUpdated._parse(self.client, update, users, chats),
|
||||||
ChatMemberUpdatedHandler
|
ChatMemberUpdatedHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
async def chat_join_request_parser(update, users, chats):
|
async def chat_join_request_parser(update, users, chats):
|
||||||
return (
|
return (
|
||||||
pyrogram.types.ChatJoinRequest._parse(self.client, update, users, chats),
|
pyrofork.types.ChatJoinRequest._parse(self.client, update, users, chats),
|
||||||
ChatJoinRequestHandler
|
ChatJoinRequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
async def story_parser(update, users, chats):
|
async def story_parser(update, users, chats):
|
||||||
return (
|
return (
|
||||||
await pyrogram.types.Story._parse(self.client, update.story, update.peer),
|
await pyrofork.types.Story._parse(self.client, update.story, update.peer),
|
||||||
StoryHandler
|
StoryHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
async def message_bot_na_reaction_parser(update, users, chats):
|
async def message_bot_na_reaction_parser(update, users, chats):
|
||||||
return (
|
return (
|
||||||
pyrogram.types.MessageReactionUpdated._parse(self.client, update, users, chats),
|
pyrofork.types.MessageReactionUpdated._parse(self.client, update, users, chats),
|
||||||
MessageReactionUpdatedHandler
|
MessageReactionUpdatedHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
async def message_bot_a_reaction_parser(update, users, chats):
|
async def message_bot_a_reaction_parser(update, users, chats):
|
||||||
return (
|
return (
|
||||||
pyrogram.types.MessageReactionCountUpdated._parse(self.client, update, users, chats),
|
pyrofork.types.MessageReactionCountUpdated._parse(self.client, update, users, chats),
|
||||||
MessageReactionCountUpdatedHandler
|
MessageReactionCountUpdatedHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -273,15 +273,15 @@ class Dispatcher:
|
||||||
self.client,
|
self.client,
|
||||||
*args
|
*args
|
||||||
)
|
)
|
||||||
except pyrogram.StopPropagation:
|
except pyrofork.StopPropagation:
|
||||||
raise
|
raise
|
||||||
except pyrogram.ContinuePropagation:
|
except pyrofork.ContinuePropagation:
|
||||||
continue
|
continue
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception(e)
|
log.exception(e)
|
||||||
|
|
||||||
break
|
break
|
||||||
except pyrogram.StopPropagation:
|
except pyrofork.StopPropagation:
|
||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception(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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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 = "\U0001f600"
|
||||||
GRINNING_FACE_WITH_BIG_EYES = "\U0001f603"
|
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) 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
|
# 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
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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_action import ChatAction
|
||||||
from .chat_event_action import ChatEventAction
|
from .chat_event_action import ChatEventAction
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue