diff --git a/liteyuki/bot/__init__.py b/liteyuki/bot/__init__.py index cfffc3ca..bf2d011d 100644 --- a/liteyuki/bot/__init__.py +++ b/liteyuki/bot/__init__.py @@ -12,7 +12,7 @@ from liteyuki.bot.lifespan import (LIFESPAN_FUNC, Lifespan) from liteyuki.comm.channel import get_channel from liteyuki.core.manager import ProcessManager from liteyuki.log import init_log, logger -from liteyuki.plugin import load_plugins +from liteyuki.plugin import load_plugin from liteyuki.utils import IS_MAIN_PROCESS __all__ = [ @@ -54,8 +54,8 @@ class LiteyukiBot: self.stop_event = threading.Event() self.call_restart_count = 0 - """插件加载""" - load_plugins("liteyuki/plugins") # 加载轻雪插件 + """加载插件加载器""" + load_plugin("liteyuki.plugins.plugin_loader") # 加载轻雪插件 """信号处理""" signal.signal(signal.SIGINT, self._handle_exit) diff --git a/liteyuki/plugin/load.py b/liteyuki/plugin/load.py index c4bbd32d..c78d71ee 100644 --- a/liteyuki/plugin/load.py +++ b/liteyuki/plugin/load.py @@ -16,7 +16,7 @@ from typing import Optional from liteyuki.log import logger from liteyuki.plugin.model import Plugin, PluginMetadata from importlib import import_module - +from nonebot import load_builtin_plugin from liteyuki.utils import path_to_module_name _plugins: dict[str, Plugin] = {} diff --git a/liteyuki/plugins/plugins_loader/__init__.py b/liteyuki/plugins/plugin_loader/__init__.py similarity index 87% rename from liteyuki/plugins/plugins_loader/__init__.py rename to liteyuki/plugins/plugin_loader/__init__.py index b4210e0c..60a0508d 100644 --- a/liteyuki/plugins/plugins_loader/__init__.py +++ b/liteyuki/plugins/plugin_loader/__init__.py @@ -21,11 +21,10 @@ def default_plugins_loader(): """ 默认插件加载器,应在初始化时调用 """ - load_plugins("src/liteyuki_plugins") for plugin in get_config("liteyuki.plugins", []): load_plugin(plugin) - for plugin_dir in get_config("liteyuki.plugin_dirs", []): + for plugin_dir in get_config("liteyuki.plugin_dirs", ["src/liteyuki_plugins"]): load_plugins(plugin_dir)