feat(matrix): create real rooms for new chats

This commit is contained in:
Mikhail Putilovskij 2026-04-01 01:12:56 +03:00
parent 82eb711844
commit 14c091b5f5
4 changed files with 89 additions and 8 deletions

View file

@ -58,12 +58,14 @@ def build_event_dispatcher(platform: MockPlatformClient, store: StateStore) -> E
platform=platform, chat_mgr=chat_mgr, auth_mgr=auth_mgr, settings_mgr=settings_mgr
)
register_all(dispatcher)
register_matrix_handlers(dispatcher)
register_matrix_handlers(dispatcher, store=store)
return dispatcher
def build_runtime(
platform: MockPlatformClient | None = None, store: StateStore | None = None
platform: MockPlatformClient | None = None,
store: StateStore | None = None,
client: AsyncClient | None = None,
) -> MatrixRuntime:
platform = platform or MockPlatformClient()
store = store or InMemoryStore()
@ -74,7 +76,7 @@ def build_runtime(
platform=platform, chat_mgr=chat_mgr, auth_mgr=auth_mgr, settings_mgr=settings_mgr
)
register_all(dispatcher)
register_matrix_handlers(dispatcher)
register_matrix_handlers(dispatcher, client=client, store=store)
return MatrixRuntime(
platform=platform,
store=store,
@ -187,13 +189,13 @@ async def main() -> None:
if not homeserver or not user_id:
raise RuntimeError("MATRIX_HOMESERVER and MATRIX_USER_ID are required")
runtime = build_runtime(store=SQLiteStore(db_path))
client = AsyncClient(
homeserver,
user=user_id,
device_id=device_id,
store_path=os.environ.get("MATRIX_STORE_PATH"),
)
runtime = build_runtime(store=SQLiteStore(db_path), client=client)
if token:
client.access_token = token
elif password: