mirror of
http://shenjack.top:5100/shenjack/icalingua-python-bot.git
synced 2024-11-23 12:41:05 +08:00
坏re
This commit is contained in:
parent
954fbed754
commit
0858085df7
|
@ -4,14 +4,6 @@ import requests
|
|||
import traceback
|
||||
import urllib.parse
|
||||
|
||||
have_regexrs = False
|
||||
try:
|
||||
import regexrs
|
||||
have_regexrs = True
|
||||
except ImportError:
|
||||
print("未找到 regexrs 模块, 将回退到字符串 in 操作")
|
||||
have_regexrs = False
|
||||
|
||||
# import PIL
|
||||
|
||||
from typing import TYPE_CHECKING, TypeVar, Optional, Tuple, List
|
||||
|
@ -24,7 +16,7 @@ else:
|
|||
IcaNewMessage = TypeVar("NewMessage")
|
||||
IcaClient = TypeVar("IcaClient")
|
||||
|
||||
_version_ = "2.6.0-rs"
|
||||
_version_ = "2.7.0-rs"
|
||||
backend_version = "unknown"
|
||||
|
||||
def format_data_size(data_bytes: float) -> str:
|
||||
|
@ -233,11 +225,11 @@ def bmcl_rank(msg: IcaNewMessage, client: IcaClient, name: str) -> None:
|
|||
r['index'] = i
|
||||
# 搜索是否有这个名字的节点
|
||||
names: List[str] = [r["name"].lower() for r in rank_data]
|
||||
try:
|
||||
import regexrs
|
||||
pattern = regexrs.compile(name)
|
||||
finds = [pattern.match(n) for n in names]
|
||||
except Exception as e:
|
||||
# try:
|
||||
# import regexrs
|
||||
# pattern = regexrs.compile(name)
|
||||
# finds = [pattern.match(n) for n in names]
|
||||
# except Exception as e:
|
||||
finds = [name.lower() in n for n in names]
|
||||
if not any(finds):
|
||||
reply = msg.reply_with(f"未找到名为{name}的节点")
|
||||
|
|
Loading…
Reference in New Issue
Block a user