Merge branch 'dev' into master

This commit is contained in:
Ju4tCode
2021-02-02 12:04:01 +08:00
committed by GitHub
66 changed files with 5633 additions and 203 deletions

View File

@ -376,7 +376,8 @@ def regex(regex: str, flags: Union[int, re.RegexFlag] = 0) -> Rule:
根据正则表达式进行匹配。
可以通过 ``state["_matched"]`` 获取正则表达式匹配成功的文本。
可以通过 ``state["_matched"]`` ``state["_matched_groups"]`` ``state["_matched_dict"]``
获取正则表达式匹配成功的文本。
:参数:
@ -396,6 +397,8 @@ def regex(regex: str, flags: Union[int, re.RegexFlag] = 0) -> Rule:
matched = pattern.search(str(event.get_message()))
if matched:
state["_matched"] = matched.group()
state["_matched_groups"] = matched.groups()
state["_matched_dict"] = matched.groupdict()
return True
else:
return False