diff --git a/main.py b/main.py index 303987a..049078b 100644 --- a/main.py +++ b/main.py @@ -29,7 +29,7 @@ import requests import config from urllib.parse import quote, unquote import re - +import emoji models.Base.metadata.create_all(bind=engine) @@ -144,6 +144,7 @@ def h5group(nickname, db: Session = Depends(get_db)): if len(matches)>0: matchesString=matches[0] if matchesString: + matchesString=remove_emojis(matchesString) #删除emoji字符串 print("匹配到的结果:", matchesString) # 判断是否在群中 inGroup = False @@ -230,6 +231,9 @@ def helloget(q: dict): return json.dumps({"Code": 0}) +def remove_emojis(text): + return ''.join(c for c in text if c not in emoji.UNICODE_EMOJI) + # 监听机器人post日志消息 @app.post("/wxbot") # def hellopost(requestData:schemas.User):