huge refactor of the entire codebase, with the goal of improving maintainability, readability, and extensibility. This commit includes changes to almost every file in the project, including:
This commit is contained in:
+15
-15
@@ -5,6 +5,7 @@ from importlib import import_module, reload as reload_module
|
||||
from types import ModuleType
|
||||
from typing import Any, Dict, List, Optional
|
||||
import logging
|
||||
from ProviderCore.registry import get_plugin
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
@@ -370,22 +371,21 @@ def get_cmdlet_arg_choices(
|
||||
token = matrix_conf.get("access_token")
|
||||
if hs and token:
|
||||
try:
|
||||
from Provider.matrix import Matrix
|
||||
|
||||
try:
|
||||
m = Matrix(config)
|
||||
rooms = m.list_rooms(room_ids=ids)
|
||||
choices = []
|
||||
for r in rooms or []:
|
||||
name = str(r.get("name") or "").strip()
|
||||
rid = str(r.get("room_id") or "").strip()
|
||||
choices.append(name or rid)
|
||||
if choices:
|
||||
return choices
|
||||
except Exception as exc:
|
||||
logger.exception("Matrix provider failed while listing rooms: %s", exc)
|
||||
provider = get_plugin("matrix", config)
|
||||
if provider is not None:
|
||||
try:
|
||||
rooms = provider.list_rooms(room_ids=ids)
|
||||
choices = []
|
||||
for r in rooms or []:
|
||||
name = str(r.get("name") or "").strip()
|
||||
rid = str(r.get("room_id") or "").strip()
|
||||
choices.append(name or rid)
|
||||
if choices:
|
||||
return choices
|
||||
except Exception as exc:
|
||||
logger.exception("Matrix provider failed while listing rooms: %s", exc)
|
||||
except Exception as exc:
|
||||
logger.exception("Failed to import Matrix provider or initialize: %s", exc)
|
||||
logger.exception("Failed to initialize Matrix plugin: %s", exc)
|
||||
except Exception as exc:
|
||||
logger.exception("Failed to resolve matrix rooms: %s", exc)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user