feat: add realtime capturing
This commit is contained in:
1 parent
920a0235e2
commit
3c1a12750c
29 files changed
+967
-47
No files matched your search
@@ -0,0 +1,25 @@
|
||||
from collections.abc import Awaitable, Callable
|
||||
|
||||
from pyrogram import raw
|
||||
|
||||
from userbot import PyroClient
|
||||
from userbot.handlers.raw import contacts, dialog_filters, reactions
|
||||
|
||||
RawHandler = Callable[..., Awaitable[None]]
|
||||
|
||||
_MODULES = (contacts, dialog_filters, reactions)
|
||||
_REGISTRY: dict[type, RawHandler] = {
|
||||
update_type: module.handle for module in _MODULES for update_type in module.HANDLES
|
||||
}
|
||||
|
||||
|
||||
@PyroClient.on_raw_update()
|
||||
async def dispatch(
|
||||
client: PyroClient, update: raw.base.Update, users: dict, chats: dict
|
||||
) -> None:
|
||||
handler = _REGISTRY.get(type(update))
|
||||
if handler is not None:
|
||||
await handler(client, update, users, chats)
|
||||
|
||||
|
||||
handlers = dispatch.handlers
|
||||
Reference in new issue
Block a user