feat(matrix): add adapter baseline and platform-aware command hints
This commit is contained in:
parent
bcdaea5143
commit
82eb711844
20 changed files with 1127 additions and 3 deletions
23
adapter/matrix/room_router.py
Normal file
23
adapter/matrix/room_router.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from adapter.matrix.store import get_room_meta, next_chat_id, set_room_meta
|
||||
from core.store import StateStore
|
||||
|
||||
|
||||
async def resolve_chat_id(store: StateStore, room_id: str, matrix_user_id: str) -> str:
|
||||
meta = await get_room_meta(store, room_id)
|
||||
if meta and meta.get("chat_id"):
|
||||
return meta["chat_id"]
|
||||
|
||||
chat_id = await next_chat_id(store, matrix_user_id)
|
||||
await set_room_meta(
|
||||
store,
|
||||
room_id,
|
||||
{
|
||||
"room_type": "chat",
|
||||
"chat_id": chat_id,
|
||||
"display_name": f"Чат {chat_id}",
|
||||
"matrix_user_id": matrix_user_id,
|
||||
},
|
||||
)
|
||||
return chat_id
|
||||
Loading…
Add table
Add a link
Reference in a new issue