mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Compare commits
3 commits
491444dbd6
...
24d1300731
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24d1300731 | ||
|
|
03c57accfd | ||
|
|
3910c4ef93 |
14 changed files with 30 additions and 21 deletions
|
|
@ -9,7 +9,7 @@
|
|||
Homepage
|
||||
</a>
|
||||
•
|
||||
<a href="https://pyrofork.wulan17.top">
|
||||
<a href="https://pyrofork.wulan17.dev">
|
||||
Documentation
|
||||
</a>
|
||||
•
|
||||
|
|
@ -44,7 +44,7 @@ async def hello(client, message):
|
|||
app.run()
|
||||
```
|
||||
|
||||
**Pyrofork** is a modern, elegant and asynchronous [MTProto API](https://pyrofork.wulan17.top/main/topics/mtproto-vs-botapi)
|
||||
**Pyrofork** is a modern, elegant and asynchronous [MTProto API](https://pyrofork.wulan17.dev/main/topics/mtproto-vs-botapi)
|
||||
framework. It enables you to easily interact with the main Telegram API through a user account (custom client) or a bot
|
||||
identity (bot API alternative) using Python.
|
||||
|
||||
|
|
@ -72,6 +72,6 @@ pip3 install pyrofork
|
|||
|
||||
### Resources
|
||||
|
||||
- Check out the docs at https://pyrofork.wulan17.top to learn more about Pyrofork, get started right
|
||||
- Check out the docs at https://pyrofork.wulan17.dev to learn more about Pyrofork, get started right
|
||||
away and discover more in-depth material for building your client applications.
|
||||
- Join the official group at https://t.me/MayuriChan_Chat and stay tuned for news, updates and announcements.
|
||||
|
|
|
|||
|
|
@ -20,4 +20,4 @@ class {name}: # type: ignore
|
|||
raise TypeError("Base types can only be used for type checking purposes: "
|
||||
"you tried to use a base type instance as argument, "
|
||||
"but you need to instantiate one of its constructors instead. "
|
||||
"More info: https://pyrofork.wulan17.top/telegram/base/{doc_name}")
|
||||
"More info: https://pyrofork.wulan17.dev/telegram/base/{doc_name}")
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ html_theme_options = {
|
|||
"repo": "fontawesome/brands/github",
|
||||
"edit": "material/file-edit-outline",
|
||||
},
|
||||
"site_url": "https://pyrofork.wulan17.top/",
|
||||
"site_url": "https://pyrofork.wulan17.dev/",
|
||||
"repo_url": "https://github.com/Mayuri-Chan/pyrofork/",
|
||||
"repo_name": "pyrofork",
|
||||
"globaltoc_collapse": True,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ like send_audio(), send_document(), send_location(), etc...
|
|||
),
|
||||
InlineKeyboardButton( # Opens a web URL
|
||||
"URL",
|
||||
url="https://pyrofork.wulan17.top"
|
||||
url="https://pyrofork.wulan17.dev"
|
||||
),
|
||||
],
|
||||
[ # Second row
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@ It uses the @on_inline_query decorator to register an InlineQueryHandler.
|
|||
input_message_content=InputTextMessageContent(
|
||||
"Here's how to install **Pyrofork**"
|
||||
),
|
||||
url="https://pyrofork.wulan17.top/intro/install",
|
||||
url="https://pyrofork.wulan17.dev/intro/install",
|
||||
description="How to install Pyrofork",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[
|
||||
[InlineKeyboardButton(
|
||||
"Open website",
|
||||
url="https://pyrofork.wulan17.top/intro/install"
|
||||
url="https://pyrofork.wulan17.dev/intro/install"
|
||||
)]
|
||||
]
|
||||
)
|
||||
|
|
@ -40,13 +40,13 @@ It uses the @on_inline_query decorator to register an InlineQueryHandler.
|
|||
input_message_content=InputTextMessageContent(
|
||||
"Here's how to use **Pyrofork**"
|
||||
),
|
||||
url="https://pyrofork.wulan17.top/start/invoking",
|
||||
url="https://pyrofork.wulan17.dev/start/invoking",
|
||||
description="How to use Pyrofork",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[
|
||||
[InlineKeyboardButton(
|
||||
"Open website",
|
||||
url="https://pyrofork.wulan17.top/start/invoking"
|
||||
url="https://pyrofork.wulan17.dev/start/invoking"
|
||||
)]
|
||||
]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ to make it only work for specific messages in a specific chat.
|
|||
# Target chat. Can also be a list of multiple chat ids/usernames
|
||||
TARGET = -100123456789
|
||||
# Welcome message template
|
||||
MESSAGE = "{} Welcome to [Pyrofork](https://pyrofork.wulan17.top/)'s group chat {}!"
|
||||
MESSAGE = "{} Welcome to [Pyrofork](https://pyrofork.wulan17.dev/)'s group chat {}!"
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ Homepage = "https://github.com/Mayuri-Chan"
|
|||
Tracker = "https://github.com/Mayuri-Chan/pyrofork/issues"
|
||||
Community = "https://t.me/MayuriChan_Chat"
|
||||
Source = "https://github.com/Mayuri-Chan/pyrofork"
|
||||
Documentation = "https://pyrofork.wulan17.top"
|
||||
Documentation = "https://pyrofork.wulan17.dev"
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
|
|
|
|||
|
|
@ -825,7 +825,7 @@ class Client(Methods):
|
|||
if session_empty:
|
||||
if not self.api_id or not self.api_hash:
|
||||
raise AttributeError("The API key is required for new authorizations. "
|
||||
"More info: https://pyrofork.wulan17.top/main/start/auth")
|
||||
"More info: https://pyrofork.wulan17.dev/main/start/auth")
|
||||
|
||||
await self.storage.api_id(self.api_id)
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ except ImportError:
|
|||
log.warning(
|
||||
"TgCrypto is missing! "
|
||||
"Pyrogram will work the same, but at a much slower speed. "
|
||||
"More info: https://pyrofork.wulan17.top/main/topics/speedups"
|
||||
"More info: https://pyrofork.wulan17.dev/main/topics/speedups"
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,12 @@ class Dispatcher:
|
|||
|
||||
def __init__(self, client: "pyrogram.Client"):
|
||||
self.client = client
|
||||
self.loop = asyncio.get_event_loop()
|
||||
try:
|
||||
loop = asyncio.get_event_loop()
|
||||
except RuntimeError:
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
self.loop = loop
|
||||
|
||||
self.handler_worker_tasks = []
|
||||
self.locks_list = []
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ class SendMessage:
|
|||
await app.send_message("me", "Message sent with **Pyrogram**!")
|
||||
|
||||
# Disable web page previews
|
||||
await app.send_message("me", "https://pyrofork.wulan17.top",
|
||||
await app.send_message("me", "https://pyrofork.wulan17.dev",
|
||||
disable_web_page_preview=True)
|
||||
|
||||
# Reply to a message using its id
|
||||
|
|
@ -167,7 +167,7 @@ class SendMessage:
|
|||
reply_markup=InlineKeyboardMarkup(
|
||||
[
|
||||
[InlineKeyboardButton("Data", callback_data="callback_data")],
|
||||
[InlineKeyboardButton("Docs", url="https://pyrofork.wulan17.top")]
|
||||
[InlineKeyboardButton("Docs", url="https://pyrofork.wulan17.dev")]
|
||||
]))
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class UpdateProfile:
|
|||
await app.update_profile(first_name="Pyrofork")
|
||||
|
||||
# Update first name and bio
|
||||
await app.update_profile(first_name="Pyrofork", bio="https://pyrofork.wulan17.top/")
|
||||
await app.update_profile(first_name="Pyrofork", bio="https://pyrofork.wulan17.dev/")
|
||||
|
||||
# Remove the last name
|
||||
await app.update_profile(last_name="")
|
||||
|
|
|
|||
|
|
@ -29,7 +29,11 @@ from pyrogram.methods.utilities import idle as idle_module, compose as compose_m
|
|||
|
||||
def async_to_sync(obj, name):
|
||||
function = getattr(obj, name)
|
||||
try:
|
||||
main_loop = asyncio.get_event_loop()
|
||||
except RuntimeError:
|
||||
main_loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(main_loop)
|
||||
|
||||
def async_to_sync_gen(agen, loop, is_main_thread):
|
||||
async def anext(agen):
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class Identifier:
|
|||
# Compare each property of other with the corresponding property in self
|
||||
# If the property in self is None, the property in other can be anything
|
||||
# If the property in self is not None, the property in other must be the same
|
||||
for field in self.__annotations__:
|
||||
for field in self.__class__.__annotations__:
|
||||
pattern_value = getattr(self, field)
|
||||
update_value = getattr(update, field)
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ class Identifier:
|
|||
def count_populated(self):
|
||||
non_null_count = 0
|
||||
|
||||
for attr in self.__annotations__:
|
||||
for attr in self.__class__.__annotations__:
|
||||
if getattr(self, attr) is not None:
|
||||
non_null_count += 1
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue