Merge branch 'dev' of https://github.com/Fairy-Oracle-Sanctuary/NeoBot into dev
This commit is contained in:
@@ -12,6 +12,9 @@ from typing import Set
|
||||
from ..utils.exceptions import SyncHandlerError
|
||||
from ..utils.logger import logger
|
||||
|
||||
# 确保logger在模块级别可见
|
||||
__all__ = ['PluginManager', 'logger']
|
||||
|
||||
|
||||
class PluginManager:
|
||||
"""
|
||||
@@ -49,6 +52,7 @@ class PluginManager:
|
||||
for _, module_name, is_pkg in pkgutil.iter_modules([plugin_dir]):
|
||||
full_module_name = f"{package_name}.{module_name}"
|
||||
|
||||
action = "加载" # 初始化默认值
|
||||
try:
|
||||
if full_module_name in self.loaded_plugins:
|
||||
self.command_manager.unload_plugin(full_module_name)
|
||||
@@ -70,7 +74,7 @@ class PluginManager:
|
||||
logger.error(f" 插件 {module_name} 加载失败: {e} (跳过此插件)")
|
||||
except Exception as e:
|
||||
logger.exception(
|
||||
f" {action if 'action' in locals() else '加载'}插件 {module_name} 失败: {e}"
|
||||
f" 加载插件 {module_name} 失败: {e}"
|
||||
)
|
||||
|
||||
def reload_plugin(self, full_module_name: str):
|
||||
|
||||
@@ -39,9 +39,6 @@ class RedisManager:
|
||||
logger.success("Redis 连接成功!")
|
||||
else:
|
||||
logger.error("Redis 连接失败: PING 命令无响应")
|
||||
except redis.exceptions.ConnectionError as e:
|
||||
logger.error(f"Redis 连接失败: {e}")
|
||||
self._redis = None
|
||||
except Exception as e:
|
||||
logger.exception(f"Redis 初始化时发生未知错误: {e}")
|
||||
self._redis = None
|
||||
|
||||
Reference in New Issue
Block a user