This commit is contained in:
hackrobot
2024-04-11 09:37:40 +08:00
parent 121fcc094b
commit c664d276cf

View File

@@ -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')