2024-03-24 09:43:34 +08:00
|
|
|
import nonebot.plugin
|
|
|
|
|
2024-03-24 21:21:57 +08:00
|
|
|
from liteyuki.utils import init_log
|
2024-04-14 21:39:27 +08:00
|
|
|
from liteyuki.utils.base.data_manager import InstalledPlugin, plugin_db
|
|
|
|
from liteyuki.utils.base.resource import load_resources
|
|
|
|
from liteyuki.utils.message.tools import check_for_package
|
2024-03-24 09:43:34 +08:00
|
|
|
|
2024-04-06 08:48:21 +08:00
|
|
|
load_resources()
|
2024-04-06 04:23:01 +08:00
|
|
|
init_log()
|
2024-03-24 09:43:34 +08:00
|
|
|
|
|
|
|
nonebot.plugin.load_plugins("liteyuki/plugins")
|
|
|
|
nonebot.plugin.load_plugins("plugins")
|
|
|
|
|
2024-04-06 04:23:01 +08:00
|
|
|
# 从数据库读取已安装的插件
|
2024-03-26 21:33:40 +08:00
|
|
|
installed_plugins: list[InstalledPlugin] = plugin_db.all(InstalledPlugin())
|
2024-03-24 09:43:34 +08:00
|
|
|
if installed_plugins:
|
2024-03-26 21:33:40 +08:00
|
|
|
for installed_plugin in installed_plugins:
|
2024-03-26 22:33:17 +08:00
|
|
|
if not check_for_package(installed_plugin.module_name):
|
2024-03-24 09:43:34 +08:00
|
|
|
nonebot.logger.error(f"{installed_plugin.module_name} not installed, but in loading database. please run `npm fixup` in chat to reinstall it.")
|
|
|
|
else:
|
2024-03-26 17:14:41 +08:00
|
|
|
nonebot.load_plugin(installed_plugin.module_name)
|