feat: add platform chat id room metadata helpers

This commit is contained in:
Mikhail Putilovskij 2026-04-19 16:50:12 +03:00
parent 9bb93fbbda
commit f3f9b10d6b
2 changed files with 36 additions and 0 deletions

View file

@ -19,6 +19,19 @@ async def set_room_meta(store: StateStore, room_id: str, meta: dict) -> None:
await store.set(f"{ROOM_META_PREFIX}{room_id}", meta)
async def get_platform_chat_id(store: StateStore, room_id: str) -> str | None:
meta = await get_room_meta(store, room_id)
return meta.get("platform_chat_id") if meta else None
async def set_platform_chat_id(
store: StateStore, room_id: str, platform_chat_id: str
) -> None:
meta = await get_room_meta(store, room_id) or {}
meta["platform_chat_id"] = platform_chat_id
await set_room_meta(store, room_id, meta)
async def get_user_meta(store: StateStore, matrix_user_id: str) -> dict | None:
return await store.get(f"{USER_META_PREFIX}{matrix_user_id}")