集成help以及init到core内,修改baseplugin为plugin

This commit is contained in:
2026-01-02 14:36:16 +08:00
parent 3f76e7d022
commit bfb36a1aa5
6 changed files with 52 additions and 54 deletions

11
main.py
View File

@@ -10,8 +10,8 @@ import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import base_plugins # noqa: F401 别动这里是加载插件的
from core import WS
from core.plugin_manager import load_all_plugins
class PluginReloadHandler(FileSystemEventHandler):
@@ -59,7 +59,7 @@ class PluginReloadHandler(FileSystemEventHandler):
try:
# 重新扫描并加载插件
base_plugins.load_all_plugins()
load_all_plugins()
print("[HotReload] 插件重载完成")
except Exception as e:
print(f"[HotReload] 重载失败: {e}")
@@ -73,9 +73,12 @@ async def main():
2. 初始化 WebSocket 客户端
3. 建立连接并保持运行
"""
# 首次加载插件
load_all_plugins()
# 启动文件监控
# 监控 base_plugins 目录
plugin_path = os.path.join(os.path.dirname(__file__), "base_plugins")
# 监控 plugins 目录
plugin_path = os.path.join(os.path.dirname(__file__), "plugins")
event_handler = PluginReloadHandler()
observer = Observer()