mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
🐛 : 修复群被动控制
This commit is contained in:
parent
c75b0950bd
commit
475a188a80
@ -76,20 +76,34 @@ async def _(
|
||||
bot: Bot,
|
||||
session: EventSession,
|
||||
arparma: Arparma,
|
||||
task: Query[bool] = AlconnaQuery("task.value", False),
|
||||
):
|
||||
image = None
|
||||
if task.result:
|
||||
image = await build_task(session.id3 or session.id2)
|
||||
elif session.id1 in bot.config.superusers:
|
||||
if session.id1 in bot.config.superusers:
|
||||
image = await build_plugin()
|
||||
if image:
|
||||
await Image(image.pic2bytes()).send(reply=True)
|
||||
logger.info(
|
||||
f"查看{'功能' if arparma.find('task') else '被动'}列表",
|
||||
f"查看功能列表",
|
||||
arparma.header_result,
|
||||
session=session,
|
||||
)
|
||||
else:
|
||||
await Text("权限不足捏...").send(reply=True)
|
||||
|
||||
|
||||
@_status_matcher.assign("task")
|
||||
async def _(
|
||||
session: EventSession,
|
||||
arparma: Arparma,
|
||||
):
|
||||
image = await build_task(session.id3 or session.id2)
|
||||
if image:
|
||||
await Image(image.pic2bytes()).send(reply=True)
|
||||
logger.info(
|
||||
f"查看群被动列表",
|
||||
arparma.header_result,
|
||||
session=session,
|
||||
)
|
||||
else:
|
||||
await Text("获取群被动任务失败...").send(reply=True)
|
||||
|
||||
|
||||
@_status_matcher.assign("open")
|
||||
|
||||
@ -47,7 +47,7 @@ async def _(
|
||||
file = path / "text.json"
|
||||
if not file.exists():
|
||||
await Text("未设置群欢迎消息...").finish(reply=True)
|
||||
message = json.load(open(file))["message"]
|
||||
message = json.load(open(file, encoding="utf8"))["message"]
|
||||
message_split = re.split(r"\[image:\d+\]", message)
|
||||
if len(message_split) == 1:
|
||||
await Text(message_split[0]).finish(reply=True)
|
||||
|
||||
@ -380,8 +380,12 @@ def get_img_hash(image_file: str | Path) -> str:
|
||||
返回:
|
||||
str: 哈希值
|
||||
"""
|
||||
with open(image_file, "rb") as fp:
|
||||
hash_value = imagehash.average_hash(Image.open(fp))
|
||||
hash_value = ""
|
||||
try:
|
||||
with open(image_file, "rb") as fp:
|
||||
hash_value = imagehash.average_hash(Image.open(fp))
|
||||
except Exception as e:
|
||||
logger.warning(f"获取图片Hash出错", "禁言检测", e=e)
|
||||
return str(hash_value)
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user