diff --git a/liteyuki/plugins/plugin_loader/__init__.py b/liteyuki/plugins/plugin_loader/__init__.py index 507631a0..54be78b0 100644 --- a/liteyuki/plugins/plugin_loader/__init__.py +++ b/liteyuki/plugins/plugin_loader/__init__.py @@ -1,4 +1,5 @@ import multiprocessing +import time import nonebot from nonebot import get_driver @@ -14,12 +15,19 @@ __plugin_metadata__ = PluginMetadata( homepage="" ) +from src.utils import TempConfig, common_db + liteyuki = get_bot() @liteyuki.on_after_start def _(): - print("轻雪启动完成,运行在进程", multiprocessing.current_process().name) + temp_data = common_db.where_one(TempConfig(), default=TempConfig()) + # 储存重启信息 + if temp_data.data.get("reload", False): + delta_time = time.time() - temp_data.data.get("reload_time", 0) + temp_data.data["delta_time"] = delta_time + common_db.save(temp_data) # 更新数据 @liteyuki.on_before_start diff --git a/src/liteyuki_main/core.py b/src/liteyuki_main/core.py index a0d2a279..0304d502 100644 --- a/src/liteyuki_main/core.py +++ b/src/liteyuki_main/core.py @@ -322,12 +322,19 @@ async def test_for_md_image(bot: T_Bot, api: str, data: dict): @driver.on_startup async def on_startup(): - temp_data = common_db.where_one(TempConfig(), default=TempConfig()) - # 储存重启信息 - if temp_data.data.get("reload", False): - delta_time = time.time() - temp_data.data.get("reload_time", 0) - temp_data.data["delta_time"] = delta_time - common_db.save(temp_data) # 更新数据 + # temp_data = common_db.where_one(TempConfig(), default=TempConfig()) + # # 储存重启信息 + # if temp_data.data.get("reload", False): + # delta_time = time.time() - temp_data.data.get("reload_time", 0) + # temp_data.data["delta_time"] = delta_time + # common_db.save(temp_data) # 更新数据 + """ + 该部分迁移至轻雪生命周期 + Returns: + + """ + + pass @driver.on_shutdown