fix(userbot): presence, story and profile history toggles of the capture policy take effect for each user peer

This commit is contained in:
hh committed 2026-10-19 02:29:19 +00:00
1 parent f32b772ddc
commit 92e5e737d2
10 files changed
+100 -25

No files matched your search

@@ -1,5 +1,6 @@
from datetime import UTC, datetime
from pyrogram.enums import ChatType
from pyrogram.types import Chat
from userbot.modules.avatars import note_avatar
@@ -13,7 +14,15 @@ from userbot.modules.raw_json import raw_json
async def save_private(ctx: CaptureContext, chat: Chat) -> bool:
chat_id = chat.id or 0
fields, photo_file_id, photo_unique_id = snapshot_from_chat(chat)
await write_profile(ctx.pool, ctx.account_id, chat_id, fields, raw_json(chat))
is_bot = chat.type is ChatType.BOT
await write_profile(
ctx.pool,
ctx.account_id,
chat_id,
fields,
raw_json(chat),
history=ctx.resolve_peer(chat_id, is_bot=is_bot).profile_history,
)
if photo_file_id and photo_unique_id:
await note_avatar(
ctx.pool, ctx.account_id, chat_id, "peer", photo_unique_id, photo_file_id