feat: create message capture policies
This commit is contained in:
1 parent
62aac0bf32
commit
920a0235e2
15 files changed
+700
-5
No files matched your search
@@ -0,0 +1,3 @@
|
||||
from .dialog_filters import dialog_filter_handler
|
||||
|
||||
__all__ = ["dialog_filter_handler"]
|
||||
@@ -0,0 +1,20 @@
|
||||
from pyrogram import Client, raw
|
||||
from pyrogram.handlers import RawUpdateHandler
|
||||
|
||||
from userbot.folders import FolderCache
|
||||
|
||||
_FILTER_UPDATES = (
|
||||
raw.types.UpdateDialogFilter,
|
||||
raw.types.UpdateDialogFilters,
|
||||
raw.types.UpdateDialogFilterOrder,
|
||||
)
|
||||
|
||||
|
||||
def dialog_filter_handler(cache: FolderCache) -> RawUpdateHandler:
|
||||
async def on_update(
|
||||
_client: Client, update: raw.base.Update, _users: dict, _chats: dict
|
||||
) -> None:
|
||||
if isinstance(update, _FILTER_UPDATES):
|
||||
await cache.refresh()
|
||||
|
||||
return RawUpdateHandler(on_update)
|
||||
Reference in new issue
Block a user