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,36 @@
from datetime import datetime
import asyncpg
_INSERT = """
INSERT INTO read_receipts
(account_id, chat_id, message_id, ts, reader_id, kind, raw)
VALUES ($1, $2, $3, $4, $5, $6, $7::jsonb)
ON CONFLICT (account_id, chat_id, message_id, ts) DO NOTHING
"""
async def insert_read( # noqa: PLR0913
pool: asyncpg.Pool,
account_id: int,
chat_id: int,
reader_id: int,
ts: datetime,
max_id: int,
raw: str,
) -> None:
await pool.execute(_INSERT, account_id, chat_id, max_id, ts, reader_id, "read", raw)
async def insert_listened( # noqa: PLR0913
pool: asyncpg.Pool,
account_id: int,
chat_id: int,
reader_id: int,
ts: datetime,
message_id: int,
raw: str,
) -> None:
await pool.execute(
_INSERT, account_id, chat_id, message_id, ts, reader_id, "listened", raw
)