mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2024-11-14 13:47:24 +08:00
🐛 hotfix: 移除状态卡片Linux下非储存分区
Some checks failed
Deploy VitePress site to Pages / build (push) Failing after 8m9s
Some checks failed
Deploy VitePress site to Pages / build (push) Failing after 8m9s
This commit is contained in:
parent
e6ea1b700f
commit
a77f97fd4b
@ -64,6 +64,8 @@ data
|
|||||||
- percent: float
|
- percent: float
|
||||||
- total: int
|
- total: int
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# status_card_cache = {} # lang -> bytes
|
# status_card_cache = {} # lang -> bytes
|
||||||
|
|
||||||
|
|
||||||
@ -90,11 +92,11 @@ data
|
|||||||
# 获取状态卡片
|
# 获取状态卡片
|
||||||
# bot_id 参数已经是bot参数的一部分了,不需要保留,但为了“兼容性”……
|
# bot_id 参数已经是bot参数的一部分了,不需要保留,但为了“兼容性”……
|
||||||
async def generate_status_card(
|
async def generate_status_card(
|
||||||
bot: dict,
|
bot: dict,
|
||||||
hardware: dict,
|
hardware: dict,
|
||||||
liteyuki: dict,
|
liteyuki: dict,
|
||||||
lang="zh-CN",
|
lang="zh-CN",
|
||||||
bot_id="0",
|
bot_id="0",
|
||||||
) -> bytes:
|
) -> bytes:
|
||||||
return await template2image(
|
return await template2image(
|
||||||
get_path("templates/status.html", abs_path=True),
|
get_path("templates/status.html", abs_path=True),
|
||||||
@ -269,7 +271,9 @@ async def get_hardware_data() -> dict:
|
|||||||
for disk in psutil.disk_partitions(all=True):
|
for disk in psutil.disk_partitions(all=True):
|
||||||
try:
|
try:
|
||||||
disk_usage = psutil.disk_usage(disk.mountpoint)
|
disk_usage = psutil.disk_usage(disk.mountpoint)
|
||||||
if disk_usage.total == 0:
|
if disk_usage.total == 0 or disk.mountpoint.startswith(
|
||||||
|
("/var", "/boot", "/run", "/proc", "/sys", "/dev", "/tmp", "/snap")
|
||||||
|
):
|
||||||
continue # 虚拟磁盘
|
continue # 虚拟磁盘
|
||||||
result["disk"].append(
|
result["disk"].append(
|
||||||
{
|
{
|
||||||
@ -297,7 +301,7 @@ async def get_liteyuki_data() -> dict:
|
|||||||
"python": f"{platform.python_implementation()} {platform.python_version()}",
|
"python": f"{platform.python_implementation()} {platform.python_version()}",
|
||||||
"system": f"{platform.system()} {platform.release()}",
|
"system": f"{platform.system()} {platform.release()}",
|
||||||
"runtime": time.time()
|
"runtime": time.time()
|
||||||
- temp_data.data.get("start_time", time.time()), # 运行时间秒数
|
- temp_data.data.get("start_time", time.time()), # 运行时间秒数
|
||||||
"bots": len(nonebot.get_bots()),
|
"bots": len(nonebot.get_bots()),
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user