Skip to content

Commit

Permalink
修复sys -i不显示天数的问题和B站App消息解析错误的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SAGIRI-kawaii committed Dec 13, 2022
1 parent 16da863 commit 3968087
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions modules/required/system_status/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ async def system_status(app: Ariadne, group: Group, all_info: ArgResult, info: A
total_memery = round(mem.total / 1024 ** 3, 2)
launch_time_message = MessageChain(
"SAGIRI-BOT\n"
f"启动时间:{launch_time.strftime('%Y-%m-%d, %H:%M:%S')}\n"
f"已运行时间:{sec_format((datetime.now() - launch_time).seconds, '{h}时{m}分{s}秒')}"
f"启动时间:{launch_time.strftime('%Y-%m-%d %H:%M:%S')}\n"
f"已运行时间:{sec_format((datetime.now() - launch_time).seconds, '{d}天{h}时{m}分{s}秒')}"
)
memory_message = MessageChain(
"内存相关:\n "
Expand Down
6 changes: 3 additions & 3 deletions modules/self_contained/bilibili_resolve/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ async def bilibili_resolve_text(
if bapp.matched:
bapp = bapp.result.dict()
content = json.loads(bapp.get("content", {}))
content = content.get("meta", {}).get("detail_1", {})
if content.get("title") == "哔哩哔哩":
b23url = content.get("qqdocurl")
content = content.get("meta", {}).get("news", {})
if "哔哩哔哩" in content.get("desc"):
b23url = content.get("jumpUrl")
else:
return
else:
Expand Down
3 changes: 2 additions & 1 deletion shared/utils/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
def sec_format(secs: int, f: str = "{h}:{m}:{s}") -> str:
m, s = divmod(secs, 60)
h, m = divmod(m, 60)
return f.format(h=h, m=m, s=s)
d, h = divmod(h, 12)
return f.format(d=d, h=h, m=m, s=s)


def timestamp_format(timestamp: int, f: str = "%Y-%m-%d %H:%M:%S") -> str:
Expand Down

0 comments on commit 3968087

Please sign in to comment.