import sys, io, json, re sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8") import os SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) PROJECT_ROOT = os.path.dirname(SCRIPT_DIR) with open(os.path.join(PROJECT_ROOT, "data", "raw-messages", "all_messages_combined.json"), "r", encoding="utf-8") as f: data = json.load(f) # Find all messages mentioning 花园世界 or garden garden_msgs = [] for group_name, msgs in data.items(): for msg in msgs: content = msg.get("content", "") if "花园" in content or "garden" in content.lower() or "GOS" in content or "gos" in content.lower() or "花灵" in content or "花材" in content or "花种" in content or "种花" in content or "麟贝" in content: garden_msgs.append({ "sender": msg.get("sender",""), "time": msg.get("createTime",""), "group": "dc" if group_name == "dc" else "cx", "content": content[:300] }) print("=== 花园世界相关消息: %d 条 ===" % len(garden_msgs)) for m in sorted(garden_msgs, key=lambda x: x["time"]): print("[%s] %s (%s): %s" % (m["time"][:10], m["sender"], m["group"], m["content"][:150])) print()