feat: 整合开发历史

This commit is contained in:
2026-01-04 19:38:47 +08:00
parent 0965123c1d
commit bbdeecb89b
25 changed files with 2199 additions and 506 deletions

13
main.py
View File

@@ -13,8 +13,11 @@ from watchdog.events import FileSystemEventHandler
# 初始化日志系统,必须在其他 core 模块导入之前执行
from core.logger import logger
from core.admin_manager import admin_manager
from core.ws import WS
from core.plugin_manager import load_all_plugins
from core.redis_manager import redis_manager
from core.executor import run_in_thread_pool
class PluginReloadHandler(FileSystemEventHandler):
@@ -62,7 +65,7 @@ class PluginReloadHandler(FileSystemEventHandler):
try:
# 重新扫描并加载插件
load_all_plugins()
run_in_thread_pool(load_all_plugins)
logger.success("插件重载完成")
except Exception as e:
logger.exception(f"重载失败: {e}")
@@ -78,7 +81,13 @@ async def main():
3. 建立连接并保持运行
"""
# 首次加载插件
load_all_plugins()
await run_in_thread_pool(load_all_plugins)
# 初始化 Redis 连接
await redis_manager.initialize()
# 初始化管理员管理器
await admin_manager.initialize()
# 启动文件监控
# 监控 plugins 目录