diff --git a/main.py b/main.py index b3ef71c..c0ad236 100644 --- a/main.py +++ b/main.py @@ -140,8 +140,10 @@ def h5group(nickname, db: Session = Depends(get_db)): pattern = r'收到(\w+)的在看' print(newtext) matches = re.findall(pattern, newtext) - matchesString=matches[0] - if matches: + matchesString=None + if len(matches)>0: + matchesString=matches[0] + if matchesString: print("匹配到的结果:", matchesString) # 判断是否在群中 inGroup = False