Skip to content

Commit

Permalink
🐛 优化插件加载逻辑,修复内置插件加载的问题,动态加载内置插件并增强对sys.path下包的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
snowykami committed Dec 29, 2024
1 parent fb428ff commit 3003dfa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions nonebot_plugin_marshoai/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,13 @@ async def _():
if config.marshoai_enable_plugins:
marshoai_plugin_dirs = config.marshoai_plugin_dirs # 外部插件目录列表
"""加载内置插件"""
marshoai_plugin_dirs.insert(
0, Path(__file__).parent / "plugins"
) # 预置插件目录
for p in os.listdir(Path(__file__).parent / "plugins"):
load_plugin(f"{__package__}.plugins.{p}")

"""加载指定目录插件"""
load_plugins(*marshoai_plugin_dirs)
"""加载sys.path下的包"""

"""加载sys.path下的包, 包括从pip安装的包"""
for package_name in config.marshoai_plugins:
load_plugin(package_name)
logger.info(
Expand Down

0 comments on commit 3003dfa

Please sign in to comment.