This commit is contained in:
2026-07-20 16:15:58 -07:00
parent a156700e6e
commit 7f12bc7f40
6 changed files with 217 additions and 7 deletions
+30
View File
@@ -863,6 +863,36 @@ def plugin_inline_query_choices(
return []
def plugin_query_field_map(
plugin_name: str,
config: Optional[Dict[str, Any]] = None,
) -> Dict[str, List[str]]:
pname = str(plugin_name or "").strip().lower()
if not pname:
return {}
try:
info = REGISTRY.get(pname)
if info is not None:
mapping = collect_choice(info.plugin_class)
else:
plugin = get_plugin(pname, config)
if plugin is None:
return {}
mapping = collect_choice(plugin)
result: Dict[str, List[str]] = {}
for field, choices in mapping.items():
texts = []
for c in choices:
text = str(c.get("text") or c.get("value") or "")
if text:
texts.append(text)
if texts:
result[field] = texts
return result
except Exception:
return {}
def get_plugin_for_url(url: str,
config: Optional[Dict[str, Any]] = None) -> Optional[Provider]:
name = match_plugin_name_for_url(url)