🚑 Fix bot for shield

This commit is contained in:
zhbaor 2022-09-30 21:29:10 +08:00
parent ac2a8e4d28
commit 16ae56f19c

View file

@ -13,7 +13,7 @@ db.generate_mapping()
@route("/pics/<filepath:path>")
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"