From b650acb67456bcce151bfad6e90f9497a3997158 Mon Sep 17 00:00:00 2001 From: Zhao Zuohong <1040110848@qq.com> Date: Thu, 29 Sep 2022 14:33:48 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20Fix=20db=5Fsession=20and=20CQ=20?= =?UTF-8?q?escape?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qqbot/bot.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/qqbot/bot.py b/qqbot/bot.py index 4692cd0..9e5b30b 100755 --- a/qqbot/bot.py +++ b/qqbot/bot.py @@ -25,12 +25,13 @@ def recv_msg(): and data["group_id"] == 346058845 ): name = data["raw_message"] - query = select(m for m in Melee if m.name == name) - if query.count() > 0: - return { - "reply": f"[CQ]:image,file=http://localhost:7000/pics/{name}.png", - "at_sender": False, - } + with db_session: + query = select(m for m in Melee if m.name == name) + if query.count() > 0: + return { + "reply": f"[CQ:image,file=http://localhost:7000/pics/{name}.png]", + "at_sender": False, + } return "OK"