feat(backend): watches fire on new, edited and deleted messages and on coming online, legacy keyword included

This commit is contained in:
hh committed 2026-10-19 02:57:27 +00:00
1 parent 8ed9ca1951
commit 4469938f47
12 files changed
+501 -60

No files matched your search

+5 -3
View File
@@ -13,19 +13,21 @@ async def on_user_status(client: PyroClient, user: User) -> None:
ctx = client.capture
if ctx is None or user.status is None:
return
at = datetime.now(UTC)
status = user.status.name.lower()
if ctx.resolve_peer(user.id, is_bot=bool(user.is_bot)).presence:
await repository.insert_status(
ctx.pool,
ctx.account_id,
user.id,
datetime.now(UTC),
user.status.name.lower(),
at,
status,
user.last_online_date,
user.next_offline_date,
raw_json(user.raw),
)
await notify_bg_event(ctx.pool, "presence", ctx.account_id, chat_id=user.id)
await ctx.watches.on_status(user.id, is_online=user.status.name.lower() == "online")
await ctx.watches.on_status(user.id, status, at, user.last_online_date)
handlers = on_user_status.handlers # ty: ignore[unresolved-attribute]