first commit

This commit is contained in:
debu-2 2026-10-02 11:22:40 +05:30
commit efa5080897
127 changed files with 18610 additions and 0 deletions

View file

@ -0,0 +1,16 @@
import re
PLACEHOLDER_PATTERN = re.compile(r"\{#(?:var|num)#\}")
def message_matches_template(template_text: str, message: str) -> bool:
message = message.strip()
if not message:
return False
parts = PLACEHOLDER_PATTERN.split(template_text.strip())
pattern = ""
for index, part in enumerate(parts):
pattern += re.escape(part)
if index < len(parts) - 1:
pattern += r".+?"
return re.fullmatch(pattern, message, flags=re.DOTALL) is not None