修改一下/bmcl的细节,步进版本号

This commit is contained in:
shenjack 2024-02-20 15:06:35 +08:00
parent 492800fed6
commit 1da32a4401
Signed by: shenjack
GPG Key ID: 7B1134A979775551
2 changed files with 8 additions and 12 deletions

View File

@ -6,7 +6,7 @@ from lib_not_dr.loggers import config
from data_struct import get_config, BotConfig, BotStatus from data_struct import get_config, BotConfig, BotStatus
_version_ = "0.3.1" _version_ = "0.3.2"
logger = config.get_logger("bot") logger = config.get_logger("bot")

View File

@ -1,8 +1,5 @@
import time
import json import json
import asyncio
import aiohttp import aiohttp
import socketio
from lib_not_dr.loggers import config from lib_not_dr.loggers import config
@ -10,11 +7,10 @@ from data_struct import NewMessage, SendMessage
logger = config.get_logger("bmcl") logger = config.get_logger("bmcl")
_version_ = "1.0.0"
async def bmcl(sio, reply_msg: SendMessage, msg: NewMessage): async def bmcl(sio, reply_msg: SendMessage, msg: NewMessage):
await asyncio.sleep(0.1)
await sio.emit(
"sendMessage", reply_msg.to_content("请求数据中……").to_json()
)
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.get( async with session.get(
"https://bd.bangbang93.com/openbmclapi/metric/dashboard" "https://bd.bangbang93.com/openbmclapi/metric/dashboard"
@ -51,10 +47,10 @@ async def bmcl(sio, reply_msg: SendMessage, msg: NewMessage):
data_bytes /= 1024 data_bytes /= 1024
report_msg = ( report_msg = (
"OpenBMCLAPI 状态:\n" f"OpenBMCLAPI 状态面板v{_version_} :\n"
f"在线节点: {online_node} 带宽: {online_bandwidth}Mbps\n" f"在线节点: {online_node} 带宽: {online_bandwidth}Mbps\n"
f"实时负载带宽: {data_bandwidth:.5f}Mbps 负载: {load_str:.3f}%\n" f"实时负载: {load_str:.3f}% 带宽: {data_bandwidth:.5f}Mbps\n"
f"当日请求: {data_hits} 总数据量: {data_len}" f"当日请求: {data_hits} 总数据量: {data_len}"
) )
await sio.emit( await sio.emit(
"sendMessage", "sendMessage",