mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-10 22:30:02 +08:00
Merge branch 'HibiKier:main' into main
This commit is contained in:
@@ -243,6 +243,10 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__
|
|||||||
|
|
||||||
## 更新
|
## 更新
|
||||||
|
|
||||||
|
### 2022/6/17
|
||||||
|
|
||||||
|
* 修复wordbank的一些小问题 [@pull/820](https://github.com/HibiKier/zhenxun_bot/pull/820)
|
||||||
|
|
||||||
### 2022/6/14
|
### 2022/6/14
|
||||||
|
|
||||||
* AsyncHttpx提供可关闭 ssl 验证参数 [@pull/812](https://github.com/HibiKier/zhenxun_bot/pull/812)
|
* AsyncHttpx提供可关闭 ssl 验证参数 [@pull/812](https://github.com/HibiKier/zhenxun_bot/pull/812)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ async def check(bot: Bot, event: Event, state: T_State) -> bool:
|
|||||||
list_img = get_message_img_file(event.json())
|
list_img = get_message_img_file(event.json())
|
||||||
if list_img:
|
if list_img:
|
||||||
for img_file in list_img:
|
for img_file in list_img:
|
||||||
strinfo = re.compile(f"{img_file},subType=\d*]")
|
strinfo = re.compile(f"{img_file},.*?]")
|
||||||
msg = strinfo.sub(f'{img_file}]', msg)
|
msg = strinfo.sub(f'{img_file}]', msg)
|
||||||
return bool(
|
return bool(
|
||||||
await WordBank.check(event.group_id, msg, event.is_tome())
|
await WordBank.check(event.group_id, msg, event.is_tome())
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ async def _(event: GroupMessageEvent):
|
|||||||
list_img = get_message_img_file(event.json())
|
list_img = get_message_img_file(event.json())
|
||||||
if list_img:
|
if list_img:
|
||||||
for img_file in list_img:
|
for img_file in list_img:
|
||||||
strinfo = re.compile(f"{img_file},subType=\d*]")
|
strinfo = re.compile(f"{img_file},.*?]")
|
||||||
msg = strinfo.sub(f'{img_file}]', msg)
|
msg = strinfo.sub(f'{img_file}]', msg)
|
||||||
q = await WordBank.check(
|
q = await WordBank.check(
|
||||||
event.group_id, msg, event.is_tome()
|
event.group_id, msg, event.is_tome()
|
||||||
|
|||||||
@@ -293,16 +293,16 @@ async def get__builder(event, _problem, answer, idx):
|
|||||||
if f"__placeholder_{rand}_{idx}.jpg" not in os.listdir(data_dir / f"{event.group_id}"):
|
if f"__placeholder_{rand}_{idx}.jpg" not in os.listdir(data_dir / f"{event.group_id}"):
|
||||||
break
|
break
|
||||||
rand = random.randint(1, 10000) + random.randint(1, 114514)
|
rand = random.randint(1, 10000) + random.randint(1, 114514)
|
||||||
strinfo = re.compile(f"\[CQ:image,file={r.group(1)},.*url={_x_list[0]}\?{_x_list[1]}.*\]")
|
strinfo = re.compile(f"\[CQ:image,file={r.group(1)},.*url={_x_list[0]}\?{_x_list[1]}.*?]")
|
||||||
answer = strinfo.sub(f"[__placeholder_{idx}]", answer)
|
answer = strinfo.sub(f"[__placeholder_{idx}]", answer)
|
||||||
await AsyncHttpx.download_file(
|
await AsyncHttpx.download_file(
|
||||||
img, data_dir / f"{event.group_id}" / f"__placeholder_{rand}_{idx}.jpg"
|
img, data_dir / f"{event.group_id}" / f"__placeholder_{rand}_{idx}.jpg"
|
||||||
)
|
)
|
||||||
_builder.set_placeholder(idx, f"__placeholder_{rand}_{idx}.jpg")
|
_builder.set_placeholder(idx, f"__placeholder_{rand}_{idx}.jpg")
|
||||||
idx += 1
|
idx += 1
|
||||||
r_problem = re.search(rf"\[CQ:image,file=(.*?),url={_x}.*?]", _p)
|
r_problem = re.search(rf"\[CQ:image,file=(.*?)(,subType=\d)?,url={_x}.*?]", _p)
|
||||||
if r_problem:
|
if r_problem:
|
||||||
strinfo = re.compile(f",url={_x_list[0]}\?{_x_list[1]},subType=\d*?]")
|
strinfo = re.compile(f"(,subType=\d)?,url={_x_list[0]}\?{_x_list[1]}.*?]")
|
||||||
_problem = strinfo.sub(f"]", _problem)
|
_problem = strinfo.sub(f"]", _problem)
|
||||||
_p = strinfo.sub(f"]", _p)
|
_p = strinfo.sub(f"]", _p)
|
||||||
problem += _p[: _p.find(f"[CQ:image,file={r_problem.group(1)}]")] + image(img)
|
problem += _p[: _p.find(f"[CQ:image,file={r_problem.group(1)}]")] + image(img)
|
||||||
|
|||||||
Reference in New Issue
Block a user