feat: log presence, read receipts, group leaves, links, profiles, stories

This commit is contained in:
hh committed 2026-05-29 22:13:59 +02:00
1 parent bfd16ab02c
commit bcb94b6474
31 files changed
+1298 -19

No files matched your search

@@ -0,0 +1,47 @@
import asyncpg
from userbot.modules.links.extract import LinkRow
_INSERT = """
INSERT INTO links
(account_id, chat_id, message_id, position, url, kind, web_url, web_title,
web_description, web_site_name, raw)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11::jsonb)
"""
async def insert_links( # noqa: PLR0913
pool: asyncpg.Pool,
account_id: int,
chat_id: int,
message_id: int,
rows: list[LinkRow],
raw: str,
) -> None:
async with pool.acquire() as conn, conn.transaction():
await conn.execute(
"DELETE FROM links "
"WHERE account_id = $1 AND chat_id = $2 AND message_id = $3",
account_id,
chat_id,
message_id,
)
await conn.executemany(
_INSERT,
[
(
account_id,
chat_id,
message_id,
position,
row.url,
row.kind,
row.web_url,
row.web_title,
row.web_description,
row.web_site_name,
raw,
)
for position, row in enumerate(rows)
],
)