mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
✨ 更新插件商店功能,允许在添加插件时指定源类型为 None。优化插件 ID 查找逻辑,增强代码可读性。新增 zhenxun/ui 模块导入。
This commit is contained in:
parent
394ef36424
commit
90a0ef58b9
@ -219,7 +219,7 @@ class StoreManager:
|
|||||||
return plugin_info, is_external
|
return plugin_info, is_external
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def add_plugin(cls, index_or_module: str, source: str | None) -> str:
|
async def add_plugin(cls, index_or_module: str, source: str | None = None) -> str:
|
||||||
"""添加插件
|
"""添加插件
|
||||||
|
|
||||||
参数:
|
参数:
|
||||||
@ -518,11 +518,11 @@ class StoreManager:
|
|||||||
raise PluginStoreException("插件ID不存在...")
|
raise PluginStoreException("插件ID不存在...")
|
||||||
return all_plugin_list[idx].module
|
return all_plugin_list[idx].module
|
||||||
elif isinstance(plugin_id, str):
|
elif isinstance(plugin_id, str):
|
||||||
result = (
|
if plugin_id in [v.module for v in all_plugin_list]:
|
||||||
None
|
return plugin_id
|
||||||
if plugin_id not in [v.module for v in all_plugin_list]
|
|
||||||
else plugin_id
|
for plugin_info in all_plugin_list:
|
||||||
) or next(v for v in all_plugin_list if v.name == plugin_id).module
|
if plugin_info.name.lower() == plugin_id.lower():
|
||||||
if not result:
|
return plugin_info.module
|
||||||
raise PluginStoreException("插件 Module / 名称 不存在...")
|
|
||||||
return result
|
raise PluginStoreException("插件 Module / 名称 不存在...")
|
||||||
|
|||||||
@ -50,6 +50,7 @@ class ZhenxunRepoConfig:
|
|||||||
"zhenxun/utils",
|
"zhenxun/utils",
|
||||||
"zhenxun/models",
|
"zhenxun/models",
|
||||||
"zhenxun/configs",
|
"zhenxun/configs",
|
||||||
|
"zhenxun/ui",
|
||||||
]
|
]
|
||||||
ZHENXUN_BOT_VERSION_FILE_STRING = "__version__"
|
ZHENXUN_BOT_VERSION_FILE_STRING = "__version__"
|
||||||
ZHENXUN_BOT_VERSION_FILE = Path() / ZHENXUN_BOT_VERSION_FILE_STRING
|
ZHENXUN_BOT_VERSION_FILE = Path() / ZHENXUN_BOT_VERSION_FILE_STRING
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user