ruaaaaa
This commit is contained in:
parent
f985a741f1
commit
bda8a64f2b
@ -1,14 +1,12 @@
|
|||||||
import io
|
import io
|
||||||
import re
|
|
||||||
import time
|
import time
|
||||||
import base64
|
|
||||||
import requests
|
import requests
|
||||||
import traceback
|
import traceback
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
# import PIL
|
# import PIL
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, TypeVar, Optional, Tuple
|
from typing import TYPE_CHECKING, TypeVar, Optional, Tuple, List
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from ica_typing import IcaNewMessage, IcaClient, ConfigData
|
from ica_typing import IcaNewMessage, IcaClient, ConfigData
|
||||||
@ -18,7 +16,7 @@ else:
|
|||||||
IcaNewMessage = TypeVar("NewMessage")
|
IcaNewMessage = TypeVar("NewMessage")
|
||||||
IcaClient = TypeVar("IcaClient")
|
IcaClient = TypeVar("IcaClient")
|
||||||
|
|
||||||
_version_ = "2.4.0-rs"
|
_version_ = "2.5.0-rs"
|
||||||
backend_version = "unknown"
|
backend_version = "unknown"
|
||||||
|
|
||||||
def format_data_size(data_bytes: float) -> str:
|
def format_data_size(data_bytes: float) -> str:
|
||||||
@ -226,13 +224,8 @@ def bmcl_rank(msg: IcaNewMessage, client: IcaClient, name: str) -> None:
|
|||||||
for i, r in enumerate(rank_data):
|
for i, r in enumerate(rank_data):
|
||||||
r['index'] = i
|
r['index'] = i
|
||||||
# 搜索是否有这个名字的节点
|
# 搜索是否有这个名字的节点
|
||||||
names = [r["name"].lower() for r in rank_data]
|
names: List[str] = [r["name"].lower() for r in rank_data]
|
||||||
try:
|
finds = [n.find(name) != -1 for n in names]
|
||||||
finds = [re.search(name.lower(), n) for n in names]
|
|
||||||
except re.error as e:
|
|
||||||
reply = msg.reply_with(f"正则表达式错误: {e}, 请检查输入")
|
|
||||||
client.send_message(reply)
|
|
||||||
return
|
|
||||||
if not any(finds):
|
if not any(finds):
|
||||||
reply = msg.reply_with(f"未找到名为{name}的节点")
|
reply = msg.reply_with(f"未找到名为{name}的节点")
|
||||||
client.send_message(reply)
|
client.send_message(reply)
|
||||||
|
Loading…
Reference in New Issue
Block a user