feat: add event watcher

This commit is contained in:
hh committed 2026-05-30 01:54:49 +02:00
1 parent c40e720163
commit f0afb7ec5b
11 files changed
+176 -14

No files matched your search

@@ -3,6 +3,7 @@ from pyrogram import Client
from userbot.modules.contacts import ContactCache
from userbot.modules.folders import FolderCache
from userbot.modules.watches import WatchCache
from utils.policy.models import CaptureToggles, ChatMeta, PolicySet
from utils.policy.repository import load_policy_set
from utils.policy.resolver import resolve
@@ -23,6 +24,7 @@ class CaptureContext:
self.storage = storage
self.folders = folders
self.contacts = contacts
self.watches = WatchCache(pool, account_id)
self.policies = PolicySet()
async def reload_policies(self) -> None:
@@ -44,4 +46,5 @@ async def build_capture_context(
await contacts.refresh()
ctx = CaptureContext(account_id, pool, storage, folders, contacts)
await ctx.reload_policies()
await ctx.watches.refresh()
return ctx