mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-25 00:25:04 +08:00
⚡ 优化状态卡片速度
This commit is contained in:
parent
4cdf29557c
commit
be28116a98
@ -16,6 +16,7 @@ from liteyuki.utils.message.html_tool import template2image
|
|||||||
from liteyuki.utils import satori_utils
|
from liteyuki.utils import satori_utils
|
||||||
from .counter_for_satori import satori_counter
|
from .counter_for_satori import satori_counter
|
||||||
from git import Repo
|
from git import Repo
|
||||||
|
|
||||||
require("nonebot_plugin_apscheduler")
|
require("nonebot_plugin_apscheduler")
|
||||||
from nonebot_plugin_apscheduler import scheduler
|
from nonebot_plugin_apscheduler import scheduler
|
||||||
|
|
||||||
@ -84,7 +85,8 @@ async def refresh_status_card():
|
|||||||
|
|
||||||
|
|
||||||
async def generate_status_card(bot: dict, hardware: dict, liteyuki: dict, lang="zh-CN", bot_id="0",
|
async def generate_status_card(bot: dict, hardware: dict, liteyuki: dict, lang="zh-CN", bot_id="0",
|
||||||
use_cache=False) -> bytes:
|
use_cache=False
|
||||||
|
) -> bytes:
|
||||||
if not use_cache:
|
if not use_cache:
|
||||||
return await template2image(
|
return await template2image(
|
||||||
get_path("templates/status.html", abs_path=True),
|
get_path("templates/status.html", abs_path=True),
|
||||||
@ -96,7 +98,6 @@ async def generate_status_card(bot: dict, hardware: dict, liteyuki: dict, lang="
|
|||||||
"localization": get_local_data(lang)
|
"localization": get_local_data(lang)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
debug=True
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if lang not in status_card_cache:
|
if lang not in status_card_cache:
|
||||||
@ -265,7 +266,7 @@ async def get_liteyuki_data() -> dict:
|
|||||||
temp_data: TempConfig = common_db.where_one(TempConfig(), default=TempConfig())
|
temp_data: TempConfig = common_db.where_one(TempConfig(), default=TempConfig())
|
||||||
result = {
|
result = {
|
||||||
"name" : list(get_config("nickname", [__NAME__]))[0],
|
"name" : list(get_config("nickname", [__NAME__]))[0],
|
||||||
"version": f"{__VERSION__}({commit_hash[:7] if (commit_hash and len(commit_hash) > 8) else ''})",
|
"version" : f"{__VERSION__}{'-' + commit_hash[:7] if (commit_hash and len(commit_hash) > 8) else ''}",
|
||||||
"plugins" : len(nonebot.get_loaded_plugins()),
|
"plugins" : len(nonebot.get_loaded_plugins()),
|
||||||
"resources": len(get_loaded_resource_packs()),
|
"resources": len(get_loaded_resource_packs()),
|
||||||
"nonebot" : f"{nonebot.__version__}",
|
"nonebot" : f"{nonebot.__version__}",
|
||||||
|
Loading…
Reference in New Issue
Block a user