mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-01-26 18:12:47 +08:00
🐛 优化插件加载逻辑,修复内置插件加载的问题,动态加载内置插件并增强对sys.path下包的支持
This commit is contained in:
parent
fb428ffc19
commit
3003dfad55
@ -128,12 +128,13 @@ async def _():
|
|||||||
if config.marshoai_enable_plugins:
|
if config.marshoai_enable_plugins:
|
||||||
marshoai_plugin_dirs = config.marshoai_plugin_dirs # 外部插件目录列表
|
marshoai_plugin_dirs = config.marshoai_plugin_dirs # 外部插件目录列表
|
||||||
"""加载内置插件"""
|
"""加载内置插件"""
|
||||||
marshoai_plugin_dirs.insert(
|
for p in os.listdir(Path(__file__).parent / "plugins"):
|
||||||
0, Path(__file__).parent / "plugins"
|
load_plugin(f"{__package__}.plugins.{p}")
|
||||||
) # 预置插件目录
|
|
||||||
"""加载指定目录插件"""
|
"""加载指定目录插件"""
|
||||||
load_plugins(*marshoai_plugin_dirs)
|
load_plugins(*marshoai_plugin_dirs)
|
||||||
"""加载sys.path下的包"""
|
|
||||||
|
"""加载sys.path下的包, 包括从pip安装的包"""
|
||||||
for package_name in config.marshoai_plugins:
|
for package_name in config.marshoai_plugins:
|
||||||
load_plugin(package_name)
|
load_plugin(package_name)
|
||||||
logger.info(
|
logger.info(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user