From 424d763b317cf688505de29d01112eeb9cdca01d Mon Sep 17 00:00:00 2001 From: Bluefissure Date: Wed, 17 Jan 2024 02:57:12 +0800 Subject: [PATCH] fix: /house and strip --- ffxivbot/api_caller.py | 15 ++++++++++++++- ffxivbot/handlers/QQCommand_house.py | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ffxivbot/api_caller.py b/ffxivbot/api_caller.py index 1d5cae23..c7bd0179 100644 --- a/ffxivbot/api_caller.py +++ b/ffxivbot/api_caller.py @@ -49,6 +49,20 @@ def serialize_cq(self, message): }, } ) + reply_ptn = r"\[CQ:reply,id=(\d+)\]" + reply_match = re.search(reply_ptn, msg) + if reply_match: + reply_id = reply_match.group(1) + msg = re.sub(reply_ptn, "", msg) + msg_list.append( + { + "type": "reply", + "data": { + "id": reply_id, + }, + } + ) + msg = msg.strip() if msg: msg_list.append( { @@ -58,7 +72,6 @@ def serialize_cq(self, message): }, } ) - print("msg_list:{}".format(json.dumps(msg_list, indent=2))) return msg_list diff --git a/ffxivbot/handlers/QQCommand_house.py b/ffxivbot/handlers/QQCommand_house.py index 157826b7..b3ab0f11 100644 --- a/ffxivbot/handlers/QQCommand_house.py +++ b/ffxivbot/handlers/QQCommand_house.py @@ -72,7 +72,7 @@ def get_round_ending(): if now_time < SOME_ROUND_ENDING: return SOME_ROUND_ENDING ending = SOME_ROUND_ENDING - while ending + 86400 * 9 < now_time: + while ending < now_time: ending += 86400 * 9 return ending