fix(userbot): presence, story and profile history toggles of the capture policy take effect for each user peer
This commit is contained in:
1 parent
f32b772ddc
commit
92e5e737d2
10 files changed
+100
-25
No files matched your search
@@ -6,7 +6,7 @@ from userbot.modules.capture.pending import PendingDeletes
|
||||
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.models import CaptureToggles, ChatKind, ChatMeta, PolicySet
|
||||
from utils.policy.repository import load_policy_set
|
||||
from utils.policy.resolver import resolve
|
||||
from utils.storage import ContentAddressedStorage
|
||||
@@ -38,6 +38,16 @@ class CaptureContext:
|
||||
def resolve(self, chat: ChatMeta) -> CaptureToggles:
|
||||
return resolve(chat, self.folders.folders, self.policies)
|
||||
|
||||
def resolve_peer(self, peer_id: int, *, is_bot: bool = False) -> CaptureToggles:
|
||||
return self.resolve(
|
||||
ChatMeta(
|
||||
chat_id=peer_id,
|
||||
kind=ChatKind.DM,
|
||||
is_bot=is_bot,
|
||||
is_contact=peer_id in self.contacts.ids,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
async def build_capture_context(
|
||||
client: Client,
|
||||
|
||||
Reference in new issue
Block a user