新增启动时对本地仓库的检测

This commit is contained in:
2024-06-01 15:26:13 +08:00
parent 62928e47eb
commit 4cdf29557c
3 changed files with 13 additions and 4 deletions

View File

@ -15,11 +15,11 @@ from liteyuki.utils.base.resource import get_loaded_resource_packs, get_path
from liteyuki.utils.message.html_tool import template2image
from liteyuki.utils import satori_utils
from .counter_for_satori import satori_counter
from git import Repo
require("nonebot_plugin_apscheduler")
from nonebot_plugin_apscheduler import scheduler
commit_hash = None
commit_hash = Repo(".").head.commit.hexsha
protocol_names = {
0: "iPad",
@ -265,7 +265,7 @@ async def get_liteyuki_data() -> dict:
temp_data: TempConfig = common_db.where_one(TempConfig(), default=TempConfig())
result = {
"name": list(get_config("nickname", [__NAME__]))[0],
"version": f"{__VERSION__}({commit_hash})",
"version": f"{__VERSION__}({commit_hash[:7] if (commit_hash and len(commit_hash) > 8) else ''})",
"plugins": len(nonebot.get_loaded_plugins()),
"resources": len(get_loaded_resource_packs()),
"nonebot": f"{nonebot.__version__}",