mirror of
http://shenjack.top:5100/shenjack/icalingua-python-bot.git
synced 2024-11-23 12:41:05 +08:00
改进一下bmcl
This commit is contained in:
parent
f254879cf0
commit
954a5a1b19
|
@ -10,7 +10,7 @@ else:
|
||||||
NewMessage = TypeVar("NewMessage")
|
NewMessage = TypeVar("NewMessage")
|
||||||
IcaClient = TypeVar("IcaClient")
|
IcaClient = TypeVar("IcaClient")
|
||||||
|
|
||||||
_version_ = "2.1.1-rs"
|
_version_ = "2.1.2-rs"
|
||||||
|
|
||||||
def format_data_size(data_bytes: float) -> str:
|
def format_data_size(data_bytes: float) -> str:
|
||||||
data_lens = ["B", "KB", "MB", "GB", "TB"]
|
data_lens = ["B", "KB", "MB", "GB", "TB"]
|
||||||
|
@ -147,21 +147,23 @@ def bmcl_rank(msg: NewMessage, client: IcaClient, name: Optional[str]) -> None:
|
||||||
reply = msg.reply_with(f"搜索|{name}|到{len(counts)}个节点, 请用更精确的名字")
|
reply = msg.reply_with(f"搜索|{name}|到{len(counts)}个节点, 请用更精确的名字")
|
||||||
client.send_message(reply)
|
client.send_message(reply)
|
||||||
return
|
return
|
||||||
|
rank_msgs = []
|
||||||
for i, find in enumerate(finds):
|
for i, find in enumerate(finds):
|
||||||
if find:
|
if find:
|
||||||
rank = ranks[i]
|
rank = ranks[i]
|
||||||
rank_msg = (
|
rank_msg = (
|
||||||
f"名称: {rank['name']}\n"
|
f"名称: {rank['name']}-No.{i}\n"
|
||||||
# f"-{rank['full']} \n"
|
# f"-{rank['full']} \n"
|
||||||
# f"版本: {rank['version']}\n"
|
# f"版本: {rank['version']}\n"
|
||||||
f"拥有者: {rank['owner']} 状态: {rank['start']}|"
|
f"拥有者: {rank['owner']} 状态: {rank['start']}|"
|
||||||
f"h/d {format_hit_count(rank['rank']['hits'])}|{format_data_size(rank['rank']['bytes'])}"
|
f"h/d {format_hit_count(rank['rank']['hits'])}|{format_data_size(rank['rank']['bytes'])}"
|
||||||
)
|
)
|
||||||
report_msg = f"OpenBMCLAPI 面板v{_version_}-排名\n{rank_msg}\n"
|
rank_msgs.append(rank_msg)
|
||||||
reply = msg.reply_with(report_msg)
|
report_msg = f"OpenBMCLAPI 面板v{_version_}-排名\n{'\n'.join(rank_msgs)}\n"
|
||||||
client.info(report_msg)
|
reply = msg.reply_with(report_msg)
|
||||||
client.send_message(reply)
|
client.info(report_msg)
|
||||||
return
|
client.send_message(reply)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user