From c664d276cf2491fc88c3ffd19e8da13ce09668f8 Mon Sep 17 00:00:00 2001 From: hackrobot Date: Thu, 11 Apr 2024 09:37:40 +0800 Subject: [PATCH] wqdqwd --- main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index b8555ca..fce168e 100644 --- a/main.py +++ b/main.py @@ -140,15 +140,16 @@ def h5group(nickname, db: Session = Depends(get_db)): pattern = r'收到(\w+)的在看' print(newtext) matches = re.findall(pattern, newtext) + matchesString=matches[0] if matches: - print("匹配到的结果:", matches) + print("匹配到的结果:", matchesString) # 判断是否在群中 inGroup = False groupList = WXBotService.get_group_members_list( robot_wxid=config.account_wxid, from_wxid=config.chatroomId) # print('groupList', groupList) for groupItem in groupList['data']: - if groupItem['nickname'] == matches: + if groupItem['nickname'] == matchesString: inGroup = True if inGroup: return {"code": 200, "success": "fail", "message": "已经在群聊中"} @@ -156,7 +157,7 @@ def h5group(nickname, db: Session = Depends(get_db)): new_wxid = None allFriend = WXBotService.get_address_list(config.account_wxid) for friendItem in allFriend['data']["contactList"]: - if friendItem['nickname'] == matches: + if friendItem['nickname'] == matchesString: new_wxid = friendItem['wxid'] else: # print('通过nickname查不到wxid')