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"