Compare commits

..

No commits in common. "5544cb02ad84d4da6bd967e09854e9cad29fe33d" and "41e2d81ee2ca30861f21f1859f6b2d56b501451e" have entirely different histories.

2 changed files with 8 additions and 42 deletions

View File

@ -3,6 +3,7 @@ import io
import time import time
import requests import requests
import traceback import traceback
import urllib.parse
# import PIL # import PIL
@ -16,7 +17,7 @@ else:
IcaNewMessage = TypeVar("NewMessage") IcaNewMessage = TypeVar("NewMessage")
IcaClient = TypeVar("IcaClient") IcaClient = TypeVar("IcaClient")
_version_ = "2.8.1-rs" _version_ = "2.8.0-rs"
backend_version = "unknown" backend_version = "unknown"
def format_data_size(data_bytes: float) -> str: def format_data_size(data_bytes: float) -> str:
@ -212,10 +213,6 @@ def bmcl_rank_general(msg, client):
client.send_message(reply) client.send_message(reply)
FULL_DISPLAY = 3
MAX_DISPLAY = 20
def bmcl_rank(msg: IcaNewMessage, client: IcaClient | TailchatClient, name: str) -> None: def bmcl_rank(msg: IcaNewMessage, client: IcaClient | TailchatClient, name: str) -> None:
req_time = time.time() req_time = time.time()
# 记录请求时间 # 记录请求时间
@ -240,8 +237,8 @@ def bmcl_rank(msg: IcaNewMessage, client: IcaClient | TailchatClient, name: str)
# 如果找到 > 3 个节点, 则提示 不显示 # 如果找到 > 3 个节点, 则提示 不显示
counts = [f for f in finds if f] counts = [f for f in finds if f]
ranks = [rank_data[i] for i, f in enumerate(finds) if f] ranks = [rank_data[i] for i, f in enumerate(finds) if f]
if len(counts) > FULL_DISPLAY: if len(counts) > 3:
if len(counts) > MAX_DISPLAY: if len(counts) > 10:
reply = msg.reply_with(f"搜索|{name}|到{len(counts)}个节点, 请用更精确的名字") reply = msg.reply_with(f"搜索|{name}|到{len(counts)}个节点, 请用更精确的名字")
else: else:
# 4~10 个节点 只显示名称和次序 # 4~10 个节点 只显示名称和次序
@ -276,14 +273,14 @@ def bmcl_rank(msg: IcaNewMessage, client: IcaClient | TailchatClient, name: str)
# client.send_message(reply) # client.send_message(reply)
help = f"""/bmcl -> dashboard help = """/bmcl -> dashboard
/bmcl rank -> all rank /bmcl rank -> all rank
/bmcl rank <name> -> rank of <name> /bmcl rank <name> -> rank of <name>
/brrs <name> -> rank of <name> /brrs <name> -> rank of <name>
搜索限制: 搜索限制:
1- {FULL_DISPLAY} 显示全部信息 1- 3 显示全部信息
{FULL_DISPLAY+1}-{MAX_DISPLAY} 显示状态名称 4-10 显示状态名称
{MAX_DISPLAY+1}+ 不显示 11+ 不显示
""" """
# /bm93 -> 随机怪图 # /bm93 -> 随机怪图

View File

@ -1,31 +0,0 @@
from __future__ import annotations
from typing import TYPE_CHECKING, TypeVar
if TYPE_CHECKING:
from ica_typing import IcaNewMessage, IcaClient
from ica_typing import TailchatReciveMessage, TailchatClient
else:
IcaNewMessage = TypeVar("NewMessage")
IcaClient = TypeVar("IcaClient")
TailchatReciveMessage = TypeVar("TailchatReciveMessage")
TailchatClient = TypeVar("TailchatClient")
TC_client: TailchatClient | None = None
TC_msg: TailchatReciveMessage | None = None
def on_tailchat_message(msg: TailchatReciveMessage, client: TailchatClient) -> None:
global TC_client, TC_msg
TC_client = client
if msg.is_reply or msg.is_from_self:
return
if msg.content == "/send-here":
TC_msg = msg
def on_ica_message(msg: IcaNewMessage, client: IcaClient) -> None:
if TC_client is None or TC_msg is None:
return
reply = TC_msg.reply_with(f"From ICA:|{msg.room_id}|{msg.sender_id}|{msg.sender_name}|{msg.content}")
TC_client.send_message(reply)