关键词支持正则

This commit is contained in:
XuChenXu 2024-11-25 21:00:00 +08:00
parent ed167a56b5
commit 10cc5cf278

View File

@ -1,4 +1,5 @@
import os import os
import re
import httpx import httpx
import asyncio import asyncio
import unicodedata import unicodedata
@ -96,7 +97,8 @@ def msg_counter(
for i in msg_list: for i in msg_list:
# logger.debug(f"processing msg {i.plain_text}") # logger.debug(f"processing msg {i.plain_text}")
if keyword: if keyword:
if keyword not in i.plain_text: match = re.search(keyword, i.plain_text)
if not match:
continue continue
try: try:
lst[str(i.session_persist_id)] += 1 lst[str(i.session_persist_id)] += 1