From 16ae56f19cd02fbdbe7c9b171ccfa84bbd6bff86 Mon Sep 17 00:00:00 2001 From: Zhao Zuohong <1040110848@qq.com> Date: Fri, 30 Sep 2022 21:29:10 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20Fix=20bot=20for=20shield?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qqbot/31-2/bot.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qqbot/31-2/bot.py b/qqbot/31-2/bot.py index 73c421a..18a6d80 100755 --- a/qqbot/31-2/bot.py +++ b/qqbot/31-2/bot.py @@ -13,7 +13,7 @@ db.generate_mapping() @route("/pics/") def server_static(filepath): - return static_file(filepath, root="../../data/render/output") + return static_file(filepath, root="../../data/render/31-2/output") @post("/") @@ -22,14 +22,16 @@ def recv_msg(): if ( data["post_type"] == "message" and data["message_type"] == "group" - and data["group_id"] == 346058845 + and data["group_id"] in [346058845, 512621194] ): name = data["raw_message"] with db_session: query = select(m for m in Melee if m.name == name) + if query.count() == 0: + query = select(m for m in Shield if m.name == name) if query.count() > 0: return { - "reply": f"[CQ:image,file=http://localhost:7000/pics/{name}.png]", + "reply": f"[CQ:image,file=http://localhost:7000/pics/{name}.png,cache=0]", "at_sender": False, } return "OK"