feat: 插件支持正则匹配

This commit is contained in:
Soulter
2024-08-05 12:12:00 -04:00
parent abda226d63
commit 14dbdb2d83
5 changed files with 39 additions and 13 deletions

View File

@@ -1,3 +1,5 @@
import re
class CommandTokens():
def __init__(self) -> None:
self.tokens = []
@@ -16,4 +18,8 @@ class CommandParser():
cmd_tokens = CommandTokens()
cmd_tokens.tokens = message.split(" ")
cmd_tokens.len = len(cmd_tokens.tokens)
return cmd_tokens
return cmd_tokens
def regex_match(self, message: str, command: str) -> bool:
return re.search(command, message, re.MULTILINE) is not None