Daily build
This commit is contained in:
@@ -4,6 +4,9 @@ import pkgutil
|
||||
import sys
|
||||
|
||||
|
||||
from core.command_manager import matcher
|
||||
|
||||
|
||||
def load_all_plugins():
|
||||
"""
|
||||
扫描并加载当前包下所有的插件(支持文件和文件夹)
|
||||
@@ -24,12 +27,17 @@ def load_all_plugins():
|
||||
|
||||
try:
|
||||
if full_module_name in sys.modules:
|
||||
importlib.reload(sys.modules[full_module_name])
|
||||
module = importlib.reload(sys.modules[full_module_name])
|
||||
action = "重载"
|
||||
else:
|
||||
importlib.import_module(full_module_name)
|
||||
module = importlib.import_module(full_module_name)
|
||||
action = "加载"
|
||||
|
||||
# 提取插件元数据
|
||||
if hasattr(module, "__plugin_meta__"):
|
||||
meta = getattr(module, "__plugin_meta__")
|
||||
matcher.plugins[full_module_name] = meta
|
||||
|
||||
type_str = "包" if is_pkg else "文件"
|
||||
print(f" [{type_str}] 成功{action}: {module_name}")
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user