mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-11 06:39:59 +08:00
✨ 格式化db_context (#1980)
* ✨ 格式化db_context * 🔥 移除旧db-context * ⚡ 添加旧版本兼容
This commit is contained in:
@@ -54,19 +54,20 @@ class PluginInitManager:
|
||||
@classmethod
|
||||
async def install_all(cls):
|
||||
"""运行所有插件安装方法"""
|
||||
if cls.plugins:
|
||||
for module_path, model in cls.plugins.items():
|
||||
if model.install:
|
||||
class_ = model.class_()
|
||||
try:
|
||||
logger.debug(f"开始执行: {module_path}:install 方法")
|
||||
if is_coroutine_callable(class_.install):
|
||||
await class_.install()
|
||||
else:
|
||||
class_.install() # type: ignore
|
||||
logger.debug(f"执行: {module_path}:install 完成")
|
||||
except Exception as e:
|
||||
logger.error(f"执行: {module_path}:install 失败", e=e)
|
||||
if not cls.plugins:
|
||||
return
|
||||
for module_path, model in cls.plugins.items():
|
||||
if model.install:
|
||||
class_ = model.class_()
|
||||
try:
|
||||
logger.debug(f"开始执行: {module_path}:install 方法")
|
||||
if is_coroutine_callable(class_.install):
|
||||
await class_.install()
|
||||
else:
|
||||
class_.install() # type: ignore
|
||||
logger.debug(f"执行: {module_path}:install 完成")
|
||||
except Exception as e:
|
||||
logger.error(f"执行: {module_path}:install 失败", e=e)
|
||||
|
||||
@classmethod
|
||||
async def install(cls, module_path: str):
|
||||
|
||||
Reference in New Issue
Block a user