randydev commited on
Commit
1c50ffc
·
verified ·
1 Parent(s): 3a6139d
Files changed (1) hide show
  1. helper_regex.py +0 -61
helper_regex.py DELETED
@@ -1,61 +0,0 @@
1
- # Copyright (C) 2019-2025 TeamKillerX <https://github.com/TeamKillerX>
2
- #
3
- # This file is part of TeamKillerX project,
4
- # and licensed under GNU Affero General Public License v3.
5
- # See the GNU Affero General Public License for more details.
6
- #
7
- # All rights reserved. See COPYING, AUTHORS.
8
- # credits xtdevs
9
-
10
- import re
11
- import requests
12
- import json
13
-
14
- WHITELIST_WORDS = {"eval", "admin", "bot", "python", "ok", "done", "anti"}
15
-
16
- def check_anti_word_by_ryzenth(text: str):
17
- reason = ""
18
- try:
19
- response = requests.get(
20
- f"https://randydev-ryu-js.hf.space/api/v1/ai/akenox/antievalai-v2?query={text}",
21
- headers={"x-api-key": "akeno_UKQEQMt991kh2Ehh7JqJYKapx8CCyeC"}
22
- ).json()
23
- ok = json.loads(response["results"])
24
-
25
- if ok.get("reason"):
26
- reason += ok["reason"]
27
- if ok.get("is_detect") is True:
28
- return True, reason
29
- return False, reason
30
- except (json.decoder.JSONDecodeError, KeyError, TypeError):
31
- return False, reason
32
-
33
- def contains_stylish_with_whitelist(text: str) -> bool:
34
- emoji_pattern = re.compile(
35
- "[\U0001F600-\U0001F64F"
36
- "\U0001F300-\U0001F5FF"
37
- "\U0001F680-\U0001F6FF"
38
- "\U0001F1E6-\U0001F1FF"
39
- "\u2600-\u26FF\u2700-\u27BF]+", flags=re.UNICODE
40
- )
41
- try:
42
- text_wo_emoji = emoji_pattern.sub('', text)
43
- except TypeError:
44
- return False
45
-
46
- words = text_wo_emoji.split()
47
- for word in words:
48
- if word.lower() in WHITELIST_WORDS:
49
- continue
50
- for char in word:
51
- if ord(char) > 127 and not char.isascii():
52
- return True
53
- return False
54
-
55
- def is_blocked_markdown_code(message):
56
- pattern = r"(?:python|py|javascript|js|bash|sh|html|go|cpp|c|json)\n.*?"
57
- match = re.search(pattern, message, re.DOTALL | re.IGNORECASE)
58
- if match:
59
- return True
60
- else:
61
- return False