mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
perf👌: 细节优化
This commit is contained in:
parent
66c9b8045d
commit
38c79a81e3
@ -1,6 +1,7 @@
|
||||
import asyncio
|
||||
import time
|
||||
from datetime import datetime, timedelta
|
||||
from pathlib import Path
|
||||
from typing import List, Optional
|
||||
|
||||
import nonebot
|
||||
@ -84,7 +85,13 @@ async def _(bot_id: Optional[str] = None) -> Result:
|
||||
if select_bot.connect_time:
|
||||
connect_date = datetime.fromtimestamp(select_bot.connect_time)
|
||||
select_bot.connect_date = connect_date.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
version_file = Path() / "__version__"
|
||||
if version_file.exists():
|
||||
if text := version_file.open().read():
|
||||
if ver := text.replace("__version__: ", "").strip():
|
||||
select_bot.version = ver
|
||||
day_call = await Statistics.filter(create_time__gte=now - timedelta(hours=now.hour)).count()
|
||||
select_bot.day_call = day_call
|
||||
return Result.ok(bot_list, "拿到信息啦!")
|
||||
return Result.warning_("无Bot连接...")
|
||||
|
||||
|
||||
@ -35,14 +35,6 @@ class BaseInfo(BaseModel):
|
||||
"""群聊数量"""
|
||||
received_messages: int = 0
|
||||
"""今日 累计接收消息"""
|
||||
# received_messages_day: int = 0
|
||||
# """今日累计接收消息"""
|
||||
# received_messages_week: int = 0
|
||||
# """一周内累计接收消息"""
|
||||
# received_messages_month: int = 0
|
||||
# """一月内累计接收消息"""
|
||||
# received_messages_year: int = 0
|
||||
# """一年内累计接受消息"""
|
||||
connect_time: int = 0
|
||||
"""连接时间"""
|
||||
connect_date: Optional[datetime] = None
|
||||
@ -60,6 +52,11 @@ class BaseInfo(BaseModel):
|
||||
|
||||
config: Optional[Config] = None
|
||||
"""nb配置"""
|
||||
day_call: int = 0
|
||||
"""今日调用插件次数"""
|
||||
version: str = "unknown"
|
||||
"""真寻版本"""
|
||||
|
||||
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
Loading…
Reference in New Issue
Block a user