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