feat: 更新了插件商店部分功能

This commit is contained in:
2024-03-21 01:20:18 +08:00
parent 14d9f041ce
commit 79f6d50e82
10 changed files with 223 additions and 10 deletions

View File

@ -49,3 +49,26 @@ def de_escape(text: str) -> str:
def encode_url(text: str) -> str:
return quote(text, safe="")
def keywords_in_text(keywords: list[str], text: str, all_matched: bool) -> bool:
"""
检查关键词是否在文本中
Args:
keywords: 关键词列表
text: 文本
all_matched: 是否需要全部匹配
Returns:
"""
if all_matched:
for keyword in keywords:
if keyword not in text:
return False
return True
else:
for keyword in keywords:
if keyword in text:
return True
return False